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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.