Hello,
I have a problem about subsetting data.
I need to keep the observations where the variable A equals to "speech" from a dataset. Then I need to merge this new dataset with another dataset and keep the observations that are in both datasets.
It is appreciated if anyone can help me. Thank you!
Names cannot contain periods. By using ORIG.SUB you told SAS to create a dataset named SUB in library pointed to by the libref ORIG.
Names can use letter, digits and underscores. They must NOT start with a digit.
data orig;
infile "/home/Projects/Project2/A/B_clean.csv" dsd missover firstobs=2;
informat title name $10000. date MMDDYY10. ;
format date DDMMYY10.;
input title name date;
if title = "NEW" then date = '31OCT12010'd;
if title = "OLD" then date = '15JUN2008'd;
run;
data orig.sub;
set orig;
where name="speech";
run;
This is what I have written. The first part works well, but in the orig.sub step, there is an error shown below:
ERROR: Libref ORIG is not assigned.
Thank you for replying!
Names cannot contain periods. By using ORIG.SUB you told SAS to create a dataset named SUB in library pointed to by the libref ORIG.
Names can use letter, digits and underscores. They must NOT start with a digit.
data orig.sub;
set orig;
where name="speech";
run;
Did you create the ORIG library?
If not, just remove that portion of the name or declare the library first. The remainder of your code looks fine.
Sounds like you know what to do.
Post the code you created for each of those steps and if it generates errors the log from your attempt to run it.
Remember to use the Insert Code button {i} on the gui to get a pop-up window to paste/edit the lines from the log. Otherwise the forum editor will re-flow the lines and make the log harder to read.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.