BookmarkSubscribeRSS Feed
tom12122
Obsidian | Level 7

Is there a possibility to direct put statement to sas file ?

I need to export i

  • to sas file:

  • Sample code:

    data COM;

       array x[5] $3 ('a' 'b' 'c' 'd' 'e');

       array c[3] $3;

       array i[3];

       n=dim(x);

       k=dim(i);

       i[1]=0;

       ncomb=comb(n,k);    /* The one extra call goes back */

       do j=1 to ncomb+1;  /* to the first combination. */

          call allcombi(n, k, of i

  • , add, remove);
  •       do h=1 to k;

             c=x[i];

          end;

          *put @4 j= @10 'i= ' i

  • +3 'c= ' c
  • +3 add= remove=;
  •       put c

  • ;
  •     output ;

       end;

    run;

    1 REPLY 1
    ballardw
    Super User

    PUT output can be directed to a text file by adding a FILE statement in the data step;

    Data com;

         file "put the name of your output file here";

    <other code>

    run;

    I'm not sure what you mean by "SAS file" as SAS uses a fair number of different file types: data set, catalog, transport, programs as well as generating output in many more formats.

    sas-innovate-2024.png

    Don't miss out on SAS Innovate - Register now for the FREE Livestream!

    Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

     

    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
    • 810 views
    • 0 likes
    • 2 in conversation