BookmarkSubscribeRSS Feed
ariari
Calcite | Level 5
Hello.
I run following code.

%macro ptest;
%let filrf=myfile;
%let rc=%sysfunc(filename(filrf,test.sas));
%let fid=%sysfunc(fopen(&filrf,a));
%if &fid > 0 %then %do;
%let rc=%sysfunc(fread(&fid));
%let rc=%sysfunc(fput(&fid,This is test data.));
%let rc=%sysfunc(fput(&fid, // mmm mmmm mmm));
%let rc=%sysfunc(fwrite(&fid));
%let rc=%sysfunc(fclose(&fid));
%end;
%mend;
%ptest;


It's work without errors. I recived output file, but in the output file two strings in the one line. I want recive:
This is test data.
mmm mmmm mmm

I need second string start from new line.
Thanks for help.
Irena
1 REPLY 1
DF
Fluorite | Level 6 DF
Fluorite | Level 6
Do you perhaps need another fwrite operation between the two fputs?

As I recall, fput adds data to the output buffer, while fwrite submits the record. The fwrite function has a variety of options that allow you to specify the gap between each record (.e.g one line, two lines, etc.) so it might be worth looking up the online help for it.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

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
  • 1 reply
  • 702 views
  • 0 likes
  • 2 in conversation