BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

hi,

i hate  when small things  in SAS bother me 🙂

 

so this is  a  part of my   code:

 

proc sql noprint;

select count(*) into :rowcount1 from xx.secured;

quit;

 

data _null_;

SET xx.secured;

file "/aa/bbb/ccc/ddd/test.txt" dlm='|';

if _n_ = 1 then

put "&sysdate9.|&rowcount1.|&sysuserid.";

put (_all_)(~);

run;

 

then  the  header in my  output  file will show  something like
29JUL2019|    2936|abcdr4

then  i would change the select into  query to

proc sql noprint;

select  strip(put((count(*),6.)) into :rowcount1 from xx.secured;

quit;

and I get this 29JUL2019|2936    |abcdr4

but i need to get this 29JUL2019|2936|abcdr4.

also ,can  i capitalize the  sysuserid  in the put statement?

 

Any one please?

Thanks,

T

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

Use Trimmed

 

proc sql noprint;

select count(*) into :rowcount1 Trimmed from xx.secured;

quit;

View solution in original post

7 REPLIES 7
novinosrin
Tourmaline | Level 20

Use Trimmed

 

proc sql noprint;

select count(*) into :rowcount1 Trimmed from xx.secured;

quit;
Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

thank you novinosrin!

 

and do you maybe know how I can capitalize the sysuserid with some changes in the put statement?

abcdr4 to ABCDR4

novinosrin
Tourmaline | Level 20


data _null_;


put "&sysdate9.|%upcase(&sysuserid.)";

put (_all_)(~);

run;

 It's a simple %upcase function.

 

Hi @Tal  Tell you what, this is when @Kurt_Bremser  's maxims is so handy. I have it printed in my desk. It directs beautifully to look where for what.  Slick stuff and you should get that too

Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

thank you again but how  I get  to this article  of his. He got many 🙂

Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

thank you 🙂

 

novinosrin
Tourmaline | Level 20

Btw, so this would fall into Maxim 9

 

Honestly, it's so eloquent and a time saver. I use the Maxim 5 as the last option. For my convenience, I have sorted the maxims in my printed paper as 5th one to me is 52 the last one. 🙂 coz no need in asking if I can find it. In essence Maxim 9 or Maxim 7 answers/guides this thread 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

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