Help using Base SAS procedures

Write a Blank Line using Put

Reply
Regular Contributor
Posts: 173

Write a Blank Line using Put

Hi,

This may sound stupid. How do I write a blank line to my output file using PUT?
I tried "put @1 " ";" and "put;" but it didn't work. Any suggestions?

Thanks!
KevinC.
SAS Super FREQ
Posts: 8,864

Re: Write a Blank Line using Put

Hi:
It sort of depends on your whole program and what you're trying to do. Are you writing, with a DATA _NULL_ program to the LISTING destination or are you trying to insert some blank lines into ODS output???

What is your destination of choice?
What is your SAS process (procedure or data _null_)?
Can you post a slightly longer code snippet???

And, if you DO post code, you can maintain the code indentations, by putting [ pre] and [ /pre ] around your code...only that's
square bracket pre square bracket and square bracket /pre square bracket
without any spaces before or after the square bracket.

If you are using PROC REPORT or PROC TABULATE or PROC PRINT, then the PUT statement is not appropriate to use with those procedures. If you are using DATA _NULL_, then PUT works to insert lines using either of these techniques:

[pre]
ods listing;
ods html file='c:\temp\class.html' style=sasweb;
data _null_;
set sashelp.class;
file print ods=(variables=(name age height));
put _ods_;
if name = 'Mary' then
put ' ';
run;
ods html close;

ods listing;
data _null_;
file print;
if _n_ = 1 then do;
put @15 'Jabberwocky';
end;
put 'Twas brillig and the slithy toves';
put 'Did gyre and gimble in the wabe';
put ' ';
put 'All mimsy were the borogroves';
put 'And the mome raths outgrabe.';
run;
[/pre]

cynthia
N/A
Posts: 0

Re: Write a Blank Line using Put

i'm nt experienced..and havnt used yet..i'm taking base sas certification course...as far i know..

a null PUT statement can be used to output a blank line.

put;
SAS Super FREQ
Posts: 8,864

Re: Write a Blank Line using Put

Posted in reply to deleted_user
Hi:
Yes, you are correct.

And now, you ask, why didn't I use a null PUT statement?? Because when I worked with SAS/IntrNet, a null put statement did NOT send a blank line to the HTTP stream -- it was ignored. So at that time, I got into the habit of using
[pre]
Put ' ' ;
[/pre]

Which is a trivial amount of extra coding, but it ensures that I can have a program that works in the LISTING destination AND will also work if I need to submit it using SAS/IntrNet.

cynthia
N/A
Posts: 0

Re: Write a Blank Line using Put

Posted in reply to Cynthia_sas
hi cynthia,
as i said i hav no experience and havnt used it....i'm student ..whos taking base sas certification course....but..thank you for giving the useful information....it would be really helpful for me in the future.
Ask a Question
Discussion stats
  • 4 replies
  • 1139 views
  • 0 likes
  • 3 in conversation