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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 1436 views
  • 0 likes
  • 3 in conversation