BookmarkSubscribeRSS Feed
BobWilcox
Fluorite | Level 6

When I do a PROC PRINT... why do all of the variables print in Upper-Case?  How can I ensure that what's printed, is EXACTLY as the data exists?  Tnanks.

9 REPLIES 9
Reeza
Super User

@BobWilcox wrote:

When I do a PROC PRINT... why do all of the variables print in Upper-Case?  How can I ensure that what's printed, is EXACTLY as the data exists?  Tnanks.


Variable names? That's because that's how they were created, SAS doesn't really care about the case of variable names.

If you want control over the names, you can use variable labels instead which have less restrictions than SAS names.

 

data demo;
MyVar=1;
MYVAR2=2;
MyVAr3=3;
run;
title 'Mixed Case Example';
proc print data=demo label;run;
title;

proc datasets lib=work nodetails nolist;
modify demo;
rename MYVAR2=MyVar2 myvar3=MyVar3;
run;quit;

title 'Camel Case Example';
proc print data=demo ;
run;
title;

 

 

 

BobWilcox
Fluorite | Level 6
No No No... not the Variable-Names... the Variable-Contents all print in Upper-case, and I know for a fact that the data is mixed... some upper characters and some lower-characters. ....
Reeza
Super User

PROC PRINT shouldn't change the variable values. Is there a format attached to the variables? I believe there is a format that will upcase all the values, but that would have been the explicit choice of someone, not a default state.

 

 

 

BobWilcox
Fluorite | Level 6
The format of the data in question is $char175. When I do a PROC PRINT, everything appears in upper-case. I wrote something to select some specific records, containing 'LAST CYCLE'... it did NOT find any records that matched that criteria... so I tried 'Last Cycle' and if found several hundred records that matched (!?!?!).
novinosrin
Tourmaline | Level 20

Sorry I am being little cheeky, did you accidentally use UPCASE Format/Informat/ Function by chance to filter chars in your code at some point? 

BobWilcox
Fluorite | Level 6
No, the only card that appears before the PROC PRINT statement is this:
options nofmterr nodate nocenter ls=256;
ballardw
Super User

1) Please show the exact code submitted.

2) was the variable that you searched for the text "Last Cycle" the variable printed? (would not have to ask the question if you had shown the Proc print code submitted).

 

3) Ensure that the set you printed is the one that shows a format of $char175.

 

Reeza
Super User

What happens if you run the following? Does it work as expected?

Also, check your own data with the ANYLOWER function applied to the variable of interest. 

 

 

data test;
    input Var_Test $Char20.;
    cards;
ABCDE
abcde
ABcde
This is my test
hello world
HELLO WORLD
;
run;

title 'Raw data';

proc print data=test;
run;

title 'Upcase formatted';

proc print data=test;
    format var_test $upcase.;
run;

title 'Only with lowercase';

proc print data=test;
    where anylower(var_test)>0;
run;

 

If you can't provide a reproducible example or such, you may be better off working with tech support so they can see your confidential data and such. 

 

And verify if you really need NOFMTERR option, if you do, I suspect that could be causing some issues, since it's expecting formats.

BobWilcox
Fluorite | Level 6
Solved... SAS9.3... I
need to specify NOCAPS in CONFIG-file.

Thanks for all of your help.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 9 replies
  • 2358 views
  • 3 likes
  • 4 in conversation