What makes you think that the variable is common_names?
Could it be "Common Names'n instead? (EDIT: according to the proc contents output this is correct).
Add the following to the top of your program and run it all again. This should fix your variable names, check it by running a proc contents and ensure your output matches Cynthia's post.
options validvarname = v7;
As others have requested if none of these work, post the output of proc contents. That will provide allow us to provide the definitive answer. proc contents data=np.species;run;
EDIT: Saw your proc contents output. Yeah, add that option to the top of your code. Your file was imported with spaces in the names. So if you set the option to validvarname=v7 the names will then be COMMON_NAMES not COMMON NAMES. That space does matter and does mean that your variables should be references as "COMMON NAMES"n or "Category"n - there are likely trailing spaces somewhere here messing things up.
Are you using On Demand for Academics or your own SAS installation?
Hi Thanks so much, as code works now with options validvarname = v7; as i forget to include this however, with below codes the output is still showing the 'squirrel' which should not be there and my answer to the question of the beginning post still got wrong;
please help
Hi,
The issue is solved, running code below provided me the correct output. Thanks all for your valuable efforts, appreciated.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.