I would like to append 16 datasets having same column and variables name. I would like to do that using macro to stack each table
and create one with new variable having dataset name to distinguish the data in merged table.
Please suggest.
Example : I have Table Customer and Client having variable as A ,B,C, D..and soon on.
Would like to create one table MERGED
AS data from both table and new variable
A B NEW_VARIABLE
1 0 Customer_file
1 0 Client_file
So that data can be differentiated based on New_variable.?
I have created this through SQL while calculating percentage difference between two values and displayed in a table.
Use set statement option indsname=
data all;
set A B C D E F G indsname=dsn;
NEW_VARIABLE = dsn;
run;
Sorry, I don't understand the question. The simple code provided concatenates datasets A, B, C etc. and adds NEW_VARIABLE to the resulting dataset with the name of the dataset of origin. Do you mean some other sort of merging operation? Are you asking for a macro variable or macro program?
I have created this through SQL while calculating percentage difference between two values and displayed in a table.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.