BookmarkSubscribeRSS Feed
KevinC_
Fluorite | Level 6
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.
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
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
deleted_user
Not applicable
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;
Cynthia_sas
SAS Super FREQ
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
deleted_user
Not applicable
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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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