BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Brian3
Obsidian | Level 7

Hi,

I have a simple problem (I hope). I am using file and put to write text to a different sas program. For example

 

data _null_;

file "filepath.sas";

put "x=1";

run;

 

Please  can you tell me how I make it so the code writes the text to the first blank line of "filepath.sas". This is so when I run this again but with different text e.g. put "y=2", it doesn't overwrite the x=1, but adds to it underneath.

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

You need to use the FILE statement option MOD.  

View solution in original post

3 REPLIES 3
data_null__
Jade | Level 19

You need to use the FILE statement option MOD.  

Brian3
Obsidian | Level 7
Thanks very much guys, just what was needed
Tom
Super User Tom
Super User

It would be very hard to locate and overwrite the first blank line.  But as @data_null__ says it is very easy to just append to a file by adding the MOD option to the FILE statement.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1300 views
  • 3 likes
  • 3 in conversation