Hi,
data _null_;
*file log;
put 'data one;';
put ' set sashelp.class;';
put 'run;'///;
put 'proc print data=one;';
put 'run;';
run;
data _null_;
*file log;
put 'data one;' / ' set sashelp.class;' / 'run;' //// 'proc print data=one;' / 'run;';
run;
I used to use two slashes to create an empty line (one per line break) years ago.
Nowadays I need four slashes to create it (or use an additional put statement).
I don't understand why.
Thats odd, can't think of anything directly unless you had a long line which split, or some sort of special character or break. Cant find a system option for it. When I do:
data temp;
put 'line 1' //;
put 'line 2';
run;
I get:
line 1 <-
<-
<-
line 2
The reason being is that / moves the cursor to the first char of the nest row, as does put. So print line 1, move to next (/), move to next (/), move to next (put), print line 2. So two / should effectively create two blank rows.
Probably your other program that required two slashes was also using a trailing @ on PUT statements.
2356 data _null_; 2357 file test; 2358 put 'line one' @ ; 2359 put // @; 2360 put 'line three'; 2361 put /; 2362 put 'line six'; 2363 run; NOTE: The file TEST is: (system-specific pathname), (system-specific file attributes) NOTE: 6 records were written to the file (system-specific pathname). The minimum record length was 0. The maximum record length was 10. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 2364 2365 data _null_; 2366 infile test; 2367 input; 2368 list; 2369 run; NOTE: The infile TEST is: (system-specific pathname), (system-specific file attributes) RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 1 line one 8 2 0 3 line three 10 4 0 5 0 6 line six 8 NOTE: 6 records were read from the infile (system-specific pathname). The minimum record length was 0. The maximum record length was 10. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
Which version SAS and environment?
Using SAS 9.4.4 in Display Manager when I run (or to File Log)
data _null_; file print; put 'data one;' / ' set sashelp.class;' / 'run;' // 'proc print data=one;' / 'run;'; run;
result is
data one; set sashelp.class; run; proc print data=one; run;
and using //// looks like
data one; set sashelp.class; run; proc print data=one; run;
Release: 3.81 (Single User)
Build date: Aug 4, 2020 11:39:11 AM
SAS release: 9.04.01M5P09132017
SAS platform: X64_10PRO WIN
It's nice to know that the feature has not changed. It is an installation specific issue.
The default value of the formchar and formdlm options have always been a mess in my installation. I've never been able to fix the issue.
FORMCHAR=‚ƒ„…†‡ˆ‰Š‹Œ+=|-/\<>*
Formdlim is equal to a special non printable character by me.
Using the right values doesn't help in this case as I'm not ouputted a table
options formchar="|----|+|---+=|-/\<>*" formdlim=' ';
But could it be something else in this direction I should look into?
I've tried it with SAS OnDemand but get the same issue.
See what this does:
data _null_; file print n=6; put 'data one;' / ' set sashelp.class;' / 'run;' #5 'proc print data=one;' / 'run;'; run;
This is using an explicit line number, the #5 to write the output. The N= option on the File statement sets a number of lines available for output control, so has to be large enough to specify the line.
I do realize that your use case is likely more complex but if the # solution works then you have one. I spent some time working with this in the days of line printer output and placing 10 tables on a single sheet of paper starting in different line/column positions.
It would be less confusing for the above example to use:
data _null_; file print n=6; put 'data one;' #2 ' set sashelp.class;' #3 'run;' #5 'proc print data=one;' #6 'run;'; run;
Or depending on just how much text you are playing with create a LONG variable and separate values with the OS line separator characters of choice.
I don't think the Formchar has any impact and the string should be looked at with other FONTS, like the SASMONOSPACE.
First of all, thank you to everyone for the time and energy trying to figure things out.
Thanks Ballard for the explanations of n= and #.
I've tried both examples with file print as well as with file log and with file pointing to permanent file.
RESULTS tab > does not create the line (could be an HTML thing)
LOG > work for the first example but not the second one
External file > works with both examples
Are you talking about how the LOG looks in the new interfaces like SAS/Studio?
Or are you writing to an actual FILE? If to a file then how did you LOOK at the file?
I was looking in the log. But you're right. I didn't notice it. But it looks ok in a text file.
So this issue is NOT with the SAS code.
The issue is with how SAS/Studio is showing you the output.
I just put it into the class of things getting messed up by no longer using simple text file. Just like how ODS eats leading spaces in PROC PRINT output.
Try this example:
data _null_;
put 'data one;*nothing;' / ' set sashelp.class;' / 'run;' // 'proc print data=one;' / 'run;';
put 'data one;*space;' / ' set sashelp.class;' / 'run;' /' '/ 'proc print data=one;' / 'run;';
put 'data one;*non-breaking space;' / ' set sashelp.class;' / 'run;' /'A0'x/ 'proc print data=one;' / 'run;';
put 'data one;*null byte;' / ' set sashelp.class;' / 'run;' /'00'x/ 'proc print data=one;' / 'run;';
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.