BookmarkSubscribeRSS Feed
Ivy
Quartz | Level 8 Ivy
Quartz | Level 8

Dear all,

 

I tried to combine several data together by using set statement.  

 

Thought I ues length statement to set up the "var_level " as  $ 100 .  However , the var_level was still trucated. 

 

Any solution ?  Thank you very much !    (The length is enough to cover the var_level at each file. , no error message. )

 

Ivy 

 

 data rpt_cat;
length var_level $ 100. ;
set rpt_gender  

rpt_uidxinsplan ;
run;

 

3218 data rpt_cat;
3219 length var_level $ 100. ;
3220 set rpt_gender rpt_uidxinsplan ;
3221 run;

NOTE: There were 3 observations read from the data set WORK.RPT_GENDER.
NOTE: There were 14 observations read from the data set WORK.RPT_UIDXINSPLAN.
NOTE: The data set WORK.RPT_CAT has 17 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds

 

 


Original_f.PNG
4 REPLIES 4
Reeza
Super User

Please post code used. 

Make sure you put length statement before the SET statement. 

Astounding
PROC Star

Most likely, the variable also has a format attached to it that is truncating the displayed value.  Add the FORMAT statement AFTER the SET statement, to remove the format:

 

format var_level;

 

Good luck.

FreelanceReinh
Jade | Level 19

Edit: I see, @Astounding was faster and had the same idea.

 

Hello @Ivy,

 

The reason for the truncation may be a format (such as $17.) which is permanently associated with variable VAR_LEVEL. This would be shown in column "Format" of the PROC CONTENTS output for dataset RPT_CAT. You could get rid of this format by adding the following statement before the run; in your data step:

format var_level;

 

Ivy
Quartz | Level 8 Ivy
Quartz | Level 8

Thank you very much ,

 

 Removing format works beautifully !

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

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
  • 4 replies
  • 2390 views
  • 0 likes
  • 4 in conversation