I have a dataset 'wineA', here is the code I have to use, but I cannot read this dataset. I need some help with adding the code of reading 'wineA' into the following code.
data wineA2;
input dummy $ @@;
length gender $ 1;
n_char = length(dummy);
gender = substr(dummy,n_char,1);
age = substr(dummy,1,n_char-1);
if last eq 'F' then Female=input(first,5.);
else if last eq 'M' then Male=input(first,5.);
run;
proc print data=wineA2;
run;
Is WineA a SAS data set or an external data set like a txt/csv file ?
The use a simple Set Statement? 🙂
data wineA2;
set wine1;
/* More Code */;
run;
Can you please post your code and sample data as a data step? (Use the running man icon above to open the code windows and place the code there.
In addition do post your log showing the error.(Please click the </> icon above and place the log in that window).
While the advice you have gotten so far contains a lot of good ideas, I think you need more specific guidance on what to do.
To begin, while you say you created a data set wineA, notice that your program does not use wineA in any way. To use it properly, you have to determine what is in wineA. Is it a SAS data set, or a text file. If it's a SAS data set, this program will run without error:
data test;
set wineA;
run;
So let's start there and see what you get as the result.
We will probably go through several steps before your question is resolved.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.