I have to import a few columns from a data set from 1 to 4. in future I might have from 1 to n. Currently, the issue I'm facing is if i give as (diag_1 $ diag_2 $ diag_3 $ diag_4 $ ) its able to pick the string value , but if i give as (diag_1 $ - diag_4 $;) only in 1 and 4th we are getting the string , ,
Please can anyone help me on this, since I'm new to SAS.
data file1; infile '/folders/input/step1/file5.csv' dlm=',' firstobs=2; input recipno diag_1 $ - diag_4 $; run;
This is the proper use of a variable list in the INPUT statement:
input recipno (diag_1-diag_4) ($);
It is a variation of what is described in INPUT Statement: Formatted
This is the proper use of a variable list in the INPUT statement:
input recipno (diag_1-diag_4) ($);
It is a variation of what is described in INPUT Statement: Formatted
A text file is not a data set.
A data set is a SAS table. At least when talking to SAS users like you are here. Use the proper terminology to get the best help. 🙂
You want to import from a text file into a SAS data set.
No worries. That's exactly why I highlight the terminology issue 🙂
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.