My SAS Tutorials

Wednesday 19 March 2014

SAS INTERVIEWS CONCEPTUAL QUESTIONS XX

We have a comma delimited text file with 150 fields and 100000 records.
Write a SAS program with which we can read only 100th field and send this field into another text file.
Most efficient Program will be appreciated.


If you want to Learn Base SAS and Advance SAS please mail me at creativityofnature@gmail.com.

Now prepare your Base SAS and Advance SAS Certification Exams with Online Mock tests:  http://exam.sankhyana.com



For training related info kindly mail us at info@sankhyana.com
www.sankhyana.com
 

4 comments:

  1. data txt;
    infile "path\txt_in.txt" missover dlm=",";
    input var1
    var2
    .
    .
    .
    var150;
    run;
    data _null_;
    file "path\txt_out.txt";
    set txt1 (keep=var100);
    if _n_=1 then do;
    put "var100";
    end;
    run;

    ReplyDelete
    Replies
    1. Alex while reading from raw data itself we have to read only 100th , not after converting into SAS data set. Nice Try..

      Delete
  2. This comment has been removed by the author.

    ReplyDelete
  3. data txt;
    infile 'textfile.txt' dlm=',' _infile_=y;
    var100= scan(y,100,',');
    file 'path\xyz.txt';
    put var100;
    run;

    ReplyDelete