BookmarkSubscribeRSS Feed
Reeza
Super User

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?

u19696098
Fluorite | Level 6

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;

u19696098_0-1635526222806.png

u19696098_1-1635526239990.png

please help

Reeza
Super User
Squirrel and squirrel are not the same.
Reeza
Super User
The options statement should ideally go before your LIBNAME statement though.
u19696098
Fluorite | Level 6

Hi,

The issue is solved, running code below provided me the correct output. Thanks all for your valuable efforts, appreciated.

u19696098_0-1635527612956.pngu19696098_1-1635527645835.png

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 19 replies
  • 5466 views
  • 1 like
  • 7 in conversation