BookmarkSubscribeRSS Feed
IvyMcKee
Calcite | Level 5

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.

4 REPLIES 4
IvyMcKee
Calcite | Level 5

They are different formats... I don't mind changing them both to character formats but I also don't know how to do that.

novinosrin
Tourmaline | Level 20
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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 543 views
  • 2 likes
  • 4 in conversation