BookmarkSubscribeRSS Feed
sasuser123123
Quartz | Level 8
Hii..Can anyone help me for..
How Can we avoid below note while tranposing

Note: Numeric variables in the input
data set will be converted to character in the output data set
3 REPLIES 3
Astounding
PROC Star

First, let's examine the problem and why you get a note at all.

data have;
name = 'Princess Diana';
rank = 1;
run;
proc transpose data=have out=want;
   var name rank;
run;

When transposing a set of variables that include both character and numeric, SAS has a problem.  The output variable will have to be character in order to hold "Princess Diana".  So SAS has to convert the numeric variable RANK from numeric to character to be able to transpose the data.  This leads to several questions:

 

  • What is the length of the transposed variable?
  • Where will the "1" appear?  Position 1 (left-hand-justified)?  Position 8?  Position 12?  Position 14?
  • How would SAS handle a more complex situation such as a third variable with a value of 1/3 ?

The basic conclusion is that you don't know what is in your output data set without a vigorous inspection.  And if you don't know what is in it, you can't program with it accurately.  Thus the note.

 

If you want to get rid of the note, you have to change your process.  Instead of transposing a mix of character and numeric variables, you might use two transposes, one for character variables and one for numeric.  Or you might convert all your numeric variables to character before transposing.  (How to do this is an often-asked question on this board, but does not have a simple answer.)  But just snapping your fingers and removing the note is not an option.

sbxkoenk
SAS Super FREQ

Hello @sasuser123123 ,

 

I completely agree with @Astounding and I would check whether you get what you really want to get and whether the resulting dataset is the best representation you can think of.

It's much better to alter your programming logic to avoid such a note instead of just suppressing the note. You can suppress the note as in the small program below, but I am very reluctant to tell you as I don't consider that as good programming practice. Warnings for example cannot be suppressed. And Errors can only sometimes be suppressed (if you get more than X times the same error with a PROC, it can be handy to only show the first 10 or so).

options nonotes;
proc transpose data=sashelp.class out=temp;      
 var name age height;                          
run;    
proc print data=temp width=min;                  
run;
/* end of programming */

Good luck,

Koen

sbxkoenk
SAS Super FREQ

To be complete:

options nonotes;

exists but I would not use it!

I only use it (very rarely) when a macro does thousands of loops always throwing the same notes. This to avoid the LOG-window running full. And I never suppress the notes for the 1st and last loop. 

 

options nowarning;
             ---------
             13
ERROR 13-12: Unrecognized SAS option name NOWARNING.

Thus, options nowarning does not exist!

 

options ERROR=20;
ERRORS=
specifies the maximum number of observations for which SAS issues complete error messages.
If you have 500 observations throwing the same error message you might want to limit that to 20.
 
Cheers,
Koen

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 1572 views
  • 0 likes
  • 3 in conversation