Hi,
I have a output file (.txt) that I would like to read in to SAS. The delimiter used in the file is blank. I want to read every row (where some variables start from the very first column while the others have trailing blanks in front of them). Is there a way that I can read every thing (all the variables including the ones after the trailing blanks) into SAS as one variable? I tried using semi colon with keyword, using @ to change the point, and some other ways and none of them worked. The output is attached. I would like to read in the row stating the warning message after the line "THE MODEL ESTIMATION TERMINATED NORMALLY".
Any help is appreciated.
I think you will have to provide the forum with at least a small subset of the data you are trying to read, as well as what you expect from that data as a result.
Thank you for the suggestion. I uploaded the output file.
I think you meant Leading blanks.
And do you want all of the data in a single variable containing the whole row of data? Something like
Var = ' 123 12341234123412341234 09808 adrasf'
Then a data step does that easily enough
data want;
infile "your file name" LRECL=32000; /* or length of longest line*/
input var $varying32000. ; /* again length of longest line*/
run;
sorry. My mistake. I did mean leading blanks. I tried the code and it works after I added the length of the variable after $varying informat. Thanks a lot!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.