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.
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.