Here it is my data file.
And I run the following code
data work.final;
infile temp1 missover;
input date nasins $ @;
count=0;
do while (nasins ne ' ');
count+1;
output;
input nasins $ @;
end;
run;
proc print data=work.final;
run;
The log shows the following
870 data work.final;
871 infile temp1 missover;
872 input date nasins $ @;
873 count=0;
874 do while (nasins ne ' ');
875 count+1;
876 output;
877 input nasins $ @;
878 end;
879 run;
ERROR: No logical assign for filename TEMP1.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.FINAL may be incomplete. When this step was stopped there were 0
observations and 3 variables.
WARNING: Data set WORK.FINAL was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
880 proc print data=work.final;
881 run;
NOTE: No observations in data set WORK.FINAL.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
Can anyone provide some solutions?
Thans!
Here is one brute-force way to do what you're wanting...
data final (keep = date nasins);
input whole_line $ 1-80;
date=.; date=scan(whole_line,1,' ');
do i = 2 to countw(whole_line);
nasins=scan(whole_line,i,' ');
output;
end;
datalines;
1386036001 B002OO333Q B004M6XUI2 B006232JFS B00B1D03GQ B00CAKA062
1386036002 B00C6TZON6
1386036003 B001R4BT1M B00C43H85G B00DOSAMMQ B00EV207NS
;
run;
proc print data=final;
run;
Did you read the error message that you posted?
ERROR: No logical assign for filename TEMP1.
That means that there is no FILENAME statement defining what actual file TEMP1 is supposed to reference.
You can use either a libref or a quoted physical filename on the INFILE statement.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.