Help using Base SAS procedures

PROC PRINT

Reply
Occasional Contributor
Posts: 6

PROC PRINT

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.

Super User
Posts: 23,700

Re: PROC PRINT

Posted in reply to BobWilcox

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;

 

 

 

Occasional Contributor
Posts: 6

Re: PROC PRINT

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. ....
Super User
Posts: 23,700

Re: PROC PRINT

Posted in reply to BobWilcox

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.

 

 

 

Occasional Contributor
Posts: 6

Re: PROC PRINT

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 (!?!?!).
PROC Star
Posts: 1,784

Re: PROC PRINT

Posted in reply to BobWilcox

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? 

Occasional Contributor
Posts: 6

Re: PROC PRINT

Posted in reply to novinosrin
No, the only card that appears before the PROC PRINT statement is this:
options nofmterr nodate nocenter ls=256;
Super User
Posts: 13,523

Re: PROC PRINT

Posted in reply to BobWilcox

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.

 

Super User
Posts: 23,700

Re: PROC PRINT

Posted in reply to BobWilcox

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.

Occasional Contributor
Posts: 6

Re: PROC PRINT

Solved... SAS9.3... I
need to specify NOCAPS in CONFIG-file.

Thanks for all of your help.
Ask a Question
Discussion stats
  • 9 replies
  • 191 views
  • 2 likes
  • 4 in conversation