SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Solly7
Pyrite | Level 9

Hi, I need help in hard coding two variables namely Company_name & Company_code and adding them into leave table as two new columns, kindly note that the values under  Company_name is always "mac"  & Company_code values is always "rm"

 

data leave;
input calender_month leave_days leave_type_code;
datalines;
202101 2 2
202101 4 2
202101 5 2
;

 

                                                       data want

calender_month        leave_days        type_code      Company_name        Company_code         

202101                        2                           2                      mac                               rm
202101                        4                           2                      mac                               rm
202101                        5                           2                      mac                               rm


;

1 ACCEPTED SOLUTION

Accepted Solutions
AMSAS
SAS Super FREQ
data leave;
  input calender_month leave_days leave_type_code;
  company_name="mac" ;
  company_code="rm" ;
datalines;
202101 2 2 
202101 4 2 
202101 5 2 
;

View solution in original post

2 REPLIES 2
AMSAS
SAS Super FREQ
data leave;
  input calender_month leave_days leave_type_code;
  company_name="mac" ;
  company_code="rm" ;
datalines;
202101 2 2 
202101 4 2 
202101 5 2 
;
Solly7
Pyrite | Level 9
thank you so much..

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1620 views
  • 2 likes
  • 2 in conversation