I want to create a SAS dataset which contains two variables AGE and SEX. There are 26 entries. How do I program this into SAS. Sorry I'm a newbie here . lol
@zhawasli1 wrote:
I want to create a SAS dataset which contains two variables AGE and SEX.
Where is the data coming from? Are you typing it out? From a text file?
Assuming you're typing it out, you would create something as follows:
data have;
infile cards dlm=',' truncover;
input age sex $;
cards;
24, F
25, M
;;;;
run;
However, the assumption is you're more likely to read from a file or DB and this step isn't very usual in actual work.
@zhawasli1 wrote:
I want to create a SAS dataset which contains two variables AGE and SEX. There are 26 entries. How do I program this into SAS. Sorry I'm a newbie here . lol
It says error on the log window when I press run, No logical assign for filename CARD. Not completely sure what that means.
Show the code and log
I think there's a typo in my post (card versus cards) which I'll fix here in a second.
EDIT: Code is fixed and tested, runs fine.
@zhawasli1 wrote:
no its from my input right now. thank you so much!
Literally no idea what that means.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.