comp.soft-sys.sas - The SAS statistics package.
I have value in character variable that contains spaces but I need replace with underscore. So for e.g. Variable Name has following values "Compose a new message" I need this to replace to "Compose_a_new_message" I tried to use Trnswrd or Translate but it places underscore at the end. Does anyone knows function that I can replace spaces to underscore?
I am using ODS to output an html file with an ".xls" extension and then later reading the .xls file using dde back into a sas dataset. This is part of a QC process. What I am noticing is that where I have "( 0.0)" (i.e. two spaces before "0.0" in brackets) then somewhere during this process of writing out the html file or reading it back into Excel and converting to a sas dataset then the double space gets converted to a single space and I don't know why. Does anyone have any ideas on this? Also, why are people so set on converting the ascii collating character 10 into null? I have seen this in a few places.
Hi, When moving data from mainframe mascines (IBM) to Windows PC's, it often happens that CRLF is dropped in the middle of records. This make problems why SAS interpret CRLF as the end of a record. This is the file I have in 'D:\TEST\_TESTFILER\bad_file.txt' 02065170001001PSAKO20021223UDI 20030324AESN OPA2 VISION 24122002 00023090004002PVEDT20030430UDI 20030605AESROMEMHSAS 152 20030430000000003 MND. SESONGARBEIDSTILL. FRA INNREISE V NN 01038105002001PSAKO20030212UDI 20030305AESNFM/4 BARN 01006275003002PVEDT20030326UDI 20030605AESROMEMHSAS 152 20030326000000003 MND. SESONGARBEIDSTILL. FRA INNREISE V NN 02037265001001PSAKO20020719UDI 20020930AESN DUF SAK! 03004075001001PSAKO20030130UDI 20030509AESN REG.SWE.020902.DOSSNR.9-760291. 03011765001002PVEDT20030325UDI 20030512AESUDI KATAB 154 20030501200308013 MND FRA MELD. SISTEINNR 15.05.03 93036500002003PEKSP19931018UDI 19931018ILRASKEASKER OG BUM POLITIKAMMER J KOPI ADV. JOHS. STRENGE NS 93036500002004PEKSP19931021ASKE19931021VIKASKEASKER OG BUM POLITIKAMMER JTH MOTTATT ASKE 211093 93036500002005PEFFE19931124ASKE19931124VIKASKEKNV 93036500002006PARKI19931124ASKE19931124VIKASKEASKER OG BUM POLITIKAMMER 93036500002007PKORU19931124ASKE19931124VIKASKEASKER OG BUM POLITIKAMMER GUDBGUDBRANDSDAL POLITIKAMMER BSN-PASS, KOPI AV UDIS VEDTAK, ID-KORT, 02059900001001PSAKO20021112UDI 20030603AESN 191102 OPA4 01036500001022PKORU20011122UDI 20011123AESOSLOOSLO POLITIDISTRIKT UDI UTLENDINGSDIREKTORATET VEDLE To make this a good file, I have run the following code: data _null_; infile 'D:\TEST\_TESTFILER\bad_file.txt' lrecl=175 recfm=V; file 'D:\TEST\_TESTFILER\good_file.txt' lrecl=175 recfm=V; input; if length(_infile_)<175 then do; _infile_=tranwrd(_infile_,'0d0a'x," "); end; put _infile_ @; run; When I work with bad_file in EditPlus, and delete CRLF and insert two SPACE, just like I try to do with the above code, the records become 175 positions wide. But the code make them just 174 postitions wide. How is that ? Another problem is that the code has not substituted the CRLF in good_file in record 7, positon 110. Why is that so ? Regards Rune Runnest
The issue is to find if a file contains CRLF in the records. The record length is 580. In position 581 and 582 is CRLF, but those don't count. And I do not want the code to detect those CRLF's. First, I thought this code would work, but it does not. Because I want to detect CRLF in any position from 1 to 580. data _null_; infile my_file end=eof lrecl=1 recfm=V; input b $char1. ; a=lag(b); if a||b='0d0a'x then n+1; if eof then do; call symput('num_CRLF',put(n,best12.)); end; run; Will this code work ? I have written "?" where I am not sure of the right syntax. data _null_; infile my_file end=eof lrecl=?? recfm=???; length linje $580.; do until eof; if scan (linje,????) then *search from 1 to 580; do; n+1; end; if eof then do; call symput ('num_CRLF', put(n,best12.)); end; run; Regards Rune Runnestoe