BookmarkSubscribeRSS Feed
jeremy4
Quartz | Level 8

Hi,

 

Can someone please help me to reference a numeric variable when the variable name is mix of letters and numbers? Thanks!

 

Variable name: TEST10

Type: Numeric

Group: Numeric

 

Current code:

proc print data=test;

   var TEST10;

   sum TEST10;

run;

 

3 REPLIES 3
jeremy4
Quartz | Level 8

Hi Tom,

I have checked that there is a TEST10 variable in the 'test' dataset (the Name is TEST10 and there is no label to the variable) but there is an error when I run the code - 'ERROR: Variable TEST10 not found' so is there a way to correctly reference the numeric variable, despite the name being a mixture of characters and numbers?

Reeza
Super User
Your reference is correct, you're likely having a different error or the variable label is test10, not the variable name.

Run a proc contents on the data set and check the variable name and label. If you're still having trouble, show us your code, log and the results from proc contents.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 3 replies
  • 2219 views
  • 1 like
  • 3 in conversation