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 !

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1626 views
  • 0 likes
  • 4 in conversation