I'm very new to SAS - switched jobs to a place that uses SAS enterprise - and have been doing readying a lot of SAS literature on forums and got some books already, but i can't seem to figure this out! Please help! essentially I need the equivalent of a Vlookup and all the syntax before and after the statement
I have Table_A (Table in SAS) and Table_B (external table in excel). Table_A has 150,000 rows, while Table_B has 10 rows. I'm trying to write an if-then clause that:
IF Table_A.column1 [has one of the variables in] Table_B.column1 THEN write 'TRUE' [in Table_B.column2]
After that, I would probably sort and take NOT MISSING from Table_B.column2 to cut the table down to a more manageable size.
Apologies if this is too simple, but I can't find anything that works! Any suggestions of what PROC or what not would greatly be appreciated. Thanks, Larry.
First step is to get TABLE_B into a SAS dataset. If you need it back into EXCEL you can export it again.
I would do it like this:
data want ;
merge table_b (in=in1) table_a (in=in2);
by COLUMN1 ;
if in1;
COLUMN2 = in2 ;
keep column1 column2 ;
run;
But note that it would make COLUMN2 as a numeric variable with of 0 (false) or 1 (true) rather than the text strings in your example.
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.