data n;
i='SAS' ;
do i= 1 to 100;
output;
end;
stop;
proc print;
run;
Desired ouput
SAS word prints 100 times
Use a separate variable for your word. You can repurpose automatic variable _N_ to be your loop index variable. Automatic variables do not become part of the output data set.
data have; word = 'SAS' ; do _n_ = 1 to 100; output; end; run;
proc print; run;
PROC PRINT can not suppress column headers. If you really want only the word to appear you will have to use PROC REPORT which can suppress column headers with option NOHEADERS.
title; footnote; options nodate nonumber nocenter; proc report noheader; run;
If you mean to produce listing hardcopy directly from the procedure change the printing destination using PROC PRINTTO.
filename hardcopy printer; * file reference to default printer; proc printto print=hardcopy; * redirect output to printer device; proc report noheader; proc printto print=print; * reset output to default; run; filename hardcopy clear;
Read the log, it will give you a clue how to fix it. The solution is VERY simple.
This statement:
i=input(SAS,4.);
is not necessary, as you set variable i in the DO statement anyway.
Please describe what you want to do in plain language; the data you have, and the data you want.
Since you show absolutely no effort in explaining what you need, I'm out of here.
Use a separate variable for your word. You can repurpose automatic variable _N_ to be your loop index variable. Automatic variables do not become part of the output data set.
data have; word = 'SAS' ; do _n_ = 1 to 100; output; end; run;
proc print; run;
PROC PRINT can not suppress column headers. If you really want only the word to appear you will have to use PROC REPORT which can suppress column headers with option NOHEADERS.
title; footnote; options nodate nonumber nocenter; proc report noheader; run;
If you mean to produce listing hardcopy directly from the procedure change the printing destination using PROC PRINTTO.
filename hardcopy printer; * file reference to default printer; proc printto print=hardcopy; * redirect output to printer device; proc report noheader; proc printto print=print; * reset output to default; run; filename hardcopy clear;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.