Hi there,
I have 2 columns that I want to merge into 1 column. Each column has 40,000 obs in it, all of which I want to keep. I want to merge RefPer and Quid into RefQuid.
All of Refper's obs are in this format: 201911, 201912 etc.
All of Quid's obs are in this format: Q12345.
So the obs in RefQuid should all look something like this: 201911Q12345
I have tried several variations of the following:
DATA finalval
RefQuid = CATS(RefPer, Quid);
run;
I keep recieving this error message: ERROR 22-322: Syntax error, expecting one of the following: A name, a quoted string, (, /. ;. _data_ _last_, _null.
What am I doing wrong? Is there another way to merge two columns together?
Thank you.
Are the two variables character or numeric?
They are different formats... I don't mind changing them both to character formats but I also don't know how to do that.
You are simply missing a semicolon to end the DATA statement.
DATA finalval; /*I added a semicolon here*/
Set input_dataset; /*this is missing*/
Length RefQuid $10;
RefQuid = CATS(RefPer, Quid);
run;
Hi @IvyMcKee Please see if the above makes sense to you
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.