New SAS User

Completely new to SAS or trying something new with SAS? Post here for help getting started.
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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