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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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