user6037890
user6037890

Reputation: 71

Explain usage of put statement

  data _null_;
   %let _EFIRR_=0;
    %let _EFIREC_=0;

  file '/home/abc/demo/sale.csv' delimiter=',' DSD;
      put country=;
       run;

I wrote this code but couldn't find anything in the log. Shouldn't I be getting country=xyz in the log?

Upvotes: 0

Views: 75

Answers (1)

mjsqu
mjsqu

Reputation: 5417

The FILE statement is used to write out to files. I believe you were attempting to read country values from the file instead.

You need the INFILE statement:

data _null_;
  %let _EFIRR_=0;
  %let _EFIREC_=0;

  /* infile statement points to the file which is being read */
  infile '/home/abc/demo/sale.csv' delimiter=',' DSD;

  /* Input statement specifies which columns to populate from the file */
  input country $;

  /* A put statement in a data step without an associated */
  /* file statement will output lines in the log */
  put country=;
run;

Upvotes: 1

Related Questions