Hi,
I'm using SAS on demand version. I am trying to read in the txt file in to sas, but I met some problems.
I have a dataset shown as below.
And I try for a few lines of code as shown in the picture. I am confused about the delimiter and I try on "09"X.
However, the output dataset appears all dot without any values, any suggestions will really appreciate.
I don't think it it is a tab aka '09'x delimited file. I think it is a just delimited by blanks.
Try the simple and let us know
data beer_drug;
infile "home/stat440/beer_drug.txt" dlm=' ';
input RI_KEY WEEK SY GE VEND ITEM UNITS DOLLARS F $ D PR ;
run;
Post the txt file and not pics plz. I have no way of testing
Sorry, the txt file is too large and can not be attached. If without the txt file, is it possible for you to give me some advice like change the delimiter or something? Thanks
Lol didnt mean the full txt file. Please paste like 10 records as plain txt rather than as pics for the community to be able to copy paste the data and run a code against/with it
Sorry I'm newbie, still struggling for the basic.
I have paste the data below, will that be okay?
IRI_KEY WEEK SY GE VEND ITEM UNITS DOLLARS F D PR
664497 1114 0 2 33200 19180 1 2.73 NONE 0 0
664497 1114 0 2 22600 2062 2 6.38 NONE 0 0
664497 1114 0 3 22200 3 1 2.95 NONE 0 0
664497 1114 0 1 22200 500 1 1.79 NONE 0 0
664497 1114 0 1 22200 960 1 0.99 NONE 0 0
664497 1114 0 1 22200 95104 1 3.19 NONE 0 0
664497 1114 0 3 22200 315 2 3.98 NONE 0 0
664497 1114 0 2 22200 324 1 1.99 NONE 0 0
664497 1114 0 1 22200 865 4 3.96 NONE 0 0
664497 1114 0 2 22200 93043 1 2.99 NONE 0 0
664497 1114 0 1 79400 60420 1 3.79 NONE 0 0
664497 1114 0 1 47400 27517 2 6.98 NONE 0 0
664497 1114 0 1 47400 27509 1 2.99 NONE 0 0
664497 1114 0 1 47400 27520 1 2.99 NONE 0 0
664497 1114 0 1 47400 13138 4 13.96 NONE 0 0
I don't think it it is a tab aka '09'x delimited file. I think it is a just delimited by blanks.
Try the simple and let us know
data beer_drug;
infile "home/stat440/beer_drug.txt" dlm=' ';
input RI_KEY WEEK SY GE VEND ITEM UNITS DOLLARS F $ D PR ;
run;
Thank you! I try on the blank and it works.
I have another concern that all the dataset starts on the second row, and the first row appears dot. Is there anything I could do to fix that?
My bad and my apologies as I am on the 3rd pint lol
Add the option firstobs=2 in the infile statement
infile "home/stat440/beer_drug.txt" dlm=' ' firstobs=2;
this option enables to start reading records from 2nd record
It works! Thank you!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.