Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help in SAS code

Status
Not open for further replies.

Steward007

Technical User
Nov 19, 2012
2
US
Example :
Data Test_Sample;
set Test;
employeedept = SUBSTR(dept,1,5);
run;

Result
employeedept
MATH
HINDI

I have dept 'SC' also with 2 bytes. Can if else statement work here?
some thing like:
Data Test_Sample;
set Test;
employeedept = SUBSTR(dept,1,5);
If employeedept = SUBSTR(dept,1,2) then 'SC';
else MATH or HINDI;
run;

Please help me with your inputs.
 
What are you actually trying to do?

Your If... then.. construction seems wrong, looks more like a CASE statement construction from SQL.

Chris.

Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top