05-07-2015 12:40 AM
Can someone tell me why the metacharacter \n is not working for the program belw
infile cards truncover;
length a $1;
input a $150.;
05-07-2015 08:16 AM
Maybe this is what you are looking for:
a="103 Pennsylvania Ave. NW,";output;
a="Washington, DC 20216" ;output;
a="NY, DC 20216" ;output;
b=prxparse("/103 Pennsylvania Ave\. NW|Washington, DC 20216/");
Check also the following link:
05-07-2015 11:12 PM
If you have organized your dataset so that each line is on a separate observation you cannot use the SAS perl regular expression functions to operate across observations.
To check if you ever have the condition that "B" follows "A" in your data set perhaps you want to use LAG() function?
Here is a trivial example .
data want ;
input a $ ;
if a='B' and lag(a)='A' then found=1;
In this case only the second and the final observation will have FOUND set to 1.
05-12-2015 06:48 AM
I would not use SAS for this type of parsing of a structured text file. Use awk: it is designed for this. Awk is a small program available on almost all operating systems. It is part of unix. If you do not have awk, use perl, which is bigger and more complex. After you have used awk to reorganise the data, read it into SAS. You should be able to run the awk from SAS, or use a command script to run both. I use this method frequently.