BookmarkSubscribeRSS Feed
pharmacygirl
Calcite | Level 5

Hi,

 

I'm trying to run a t-test and I can't get SAS to recognize a generated transposed variable. I also don't know why it generated two of the same columns. When I attempt to rename or drop it, it gives the same error message as well:

 

ERROR: Variable LABEL_OF_FORMER_VARIABLE not found.

 

Is there a way to create the same column or copy it again so that SAS will be able to analyze it? I would REALLY appreciate any help on this because I've been stuck on this problem for days! 😞 Attached a screenshot. 


1.PNG
11 REPLIES 11
Jagadishkatam
Amethyst | Level 16
not sure if you could use in the var statement of proc ttest the character variable (LABEL_OF_FORMER_VARIABLE), we are supposed to use the numeric variable.
Thanks,
Jag
Reeza
Super User

You're seeing the variable LABEL not the variable NAME.

 

I would guess the variable name is actually _LABEL_ but verify it either by switching to the variable name (in View Menu) or using PROC CONTENTS.

Reeza
Super User

This is in addition to @Jagadishkatam correct statement that the VAR requires a numeric variable. The variable to be analyzed goes in the VAR statement, the categorical variable goes as the CLASS variable.

PGStats
Opal | Level 21

"NAME OF FORMER VARIABLE" and "LABEL OF FORMER VARIABLE" are variable labels, not names. The corresponding variable names are _NAME_ and _LABEL_.

PG
Larrihoover
Obsidian | Level 7

I think to clarify:

 

proc transpose data=old_data out = new_data (rename=(_NAME_= Field) drop = _LABEL_);
id transposed_field;
label Field = 'Field';
run;

 

Note: Works but does give a warning that Field is not found on the old_data set.

Reeza
Super User

The label statement applies to the input data set not the output. 

 

Larrihoover
Obsidian | Level 7
My output data set has Name: Field, Label: Field. If I remove the label line of code the field has Name: Field Label: NAME OF FORMER VARIABLE.
Reeza
Super User

Do you still get the warning if your remove the LABEL statement?

Larrihoover
Obsidian | Level 7
No, is there a way around that inside the transpose procedure? The warning isn't effecting me now but I am worried if I start using this dynamically.
Reeza
Super User

Try using the old variable name in the LABEL statement, instead of the new variable name. Order of operations issue, I think.

 

 

Reeza
Super User

FYI - you should start your own question and not use a question that's a few months old and may not fully relate to your issue.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 11 replies
  • 12028 views
  • 1 like
  • 5 in conversation