Hi,
I have two datasets, one is about sale of beer and another is about sale of snacks.
The two datasets have the same variables but different values, and below are part of data from beer data set.
IRI_KEY WEEK SY GE VEND ITEM UNITS DOLLARS F D PR
664497 1114 0 1 41633 2154 3 2.97 NONE 0 0
664497 1114 0 2 41633 145 6 13.14 NONE 0 0
664497 1114 0 1 41633 2119 3 2.97 NONE 0 0
664497 1114 0 2 41633 135 3 6.57 NONE 0 0
664497 1114 0 1 41633 2140 1 0.99 NONE 0 0
664497 1114 0 1 41633 2155 2 1.98 NONE 0 0
664497 1114 0 2 41633 150 1 0.69 NONE 0 0
664497 1114 0 2 41633 115 3 2.07 NONE 0 0
664497 1114 0 4 41633 136 6 13.14 NONE 0 0
664497 1114 0 1 28400 992 3 2.97 NONE 0 0
664497 1114 0 2 28400 1459 2 0.50 NONE 0 0
664497 1114 0 1 28400 981 3 2.97 NONE 0 0
664497 1114 0 1 28400 1180 2 5.98 NONE 0 0
664497 1114 0 4 28400 988 1 0.99 NONE 0 0
I'm a newbie and not quite familiar with many procedures.
I was wondering is there a procedure I could use to let me point out which part of data is from beer and which part of data is from snack after I merge the two datasets? Could I create a categorical variable and maybe use some procedures to point out each row represents the sale from beer or snack? Any suggestions will be really appreciate!
You don't merge them, you stack them, and you can use several "tricks" to determine the "type":
data want;
set
beer
snacks
indsname=dsname
;
product = dsname;
run;
Alternatively, you can use in= dataset options and evaluate the variables from there to set your product.
You don't merge them, you stack them, and you can use several "tricks" to determine the "type":
data want;
set
beer
snacks
indsname=dsname
;
product = dsname;
run;
Alternatively, you can use in= dataset options and evaluate the variables from there to set your product.
I have successfully add the name of dataset beside the variable. Thank you so much!
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.