BookmarkSubscribeRSS Feed
TANMOY05
Obsidian | Level 7
if Varname not in ( 1,2,3)  then Varname1 = input( Varname, best.) ;

What does this "Varname not in" in the above code do to variable Varname?

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Do you get an ERROR in the LOG when you run this??? What does happen when you run this???

 

VARNAME is the name of a SAS variable. If this variable exists, it should contain as values the name of SAS variables ... so the NOT IN tests to see if the value of variable varname is not in the collection of values: 1 and 2 and 3; but these values are not a valid names for a SAS variable, which has to be a character string and can't begin with a number.

 

So this code doesn't make the slightest bit of sense to me.

--
Paige Miller
art297
Opal | Level 21

It won't have any effect on varname or whatever variable that represents. What it will do is create a new variable (i.e., varname1) that will be missing where varname has values of 1, 2 or 3, or will have the values of varname.

 

Art, CEO, AnalystFinder.com

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 365 views
  • 0 likes
  • 3 in conversation