BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SASKiwi
PROC Star

@Phil_NZ  - documentation.sas.com should be your first port of call when checking out the SAS language - here is the link to the PUT statement and its many uses: PUT 

 

You can find the answers to your other questions there too.

Shmuel
Garnet | Level 18

To answer your questions:

1) Is "sheet" redundant ? - I don't think so. You assigned erroneously the line 

out= cats(substr(fname,1,3),sheet1) /* or sheet&i */

    instead I suggested: short_fn = substr(fname,1,3);

    and then argument outf is concatenation of short_fn and "sheet"

    finaly out=&outf.1  or out=&outf.&1

 

    If you deleted the "sheet" - did you got output names as wanted?
    You probably got shorter names like Arg1 instead Arg_sheet1.

 

2) PUT statement is used to right to a file (not a sas dataset).
    In your case you write to the log. That is the default output file.

    In such case it is preffered to use PUTLOG instead just PUT.

 

    To write to specific file you code like:

FILENAME <fref>   "<Path and file_name>;
/*   'fref' stands for File Reference and is limited to 8 chracters. */

/* in a data step you code */
      FILE <fref>;     /* declaring to which file to write */
      PUT <text to write>;

That answers your other (3rd & 4th) question too;

 

    

 

    

     

Phil_NZ
Barite | Level 11

@Shmuel 

Thank you very much, I almost made a mistake. Yes, I just check and it is exactly what you mentioned about the sheets' names. I just changed as your instruction and it is what I need.

Many thanks and warmest regards!

 
Thank you for your help, have a fabulous and productive day! I am a novice today, but someday when I accumulate enough knowledge, I can help others in my capacity.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 32 replies
  • 8706 views
  • 17 likes
  • 7 in conversation