My SAS Tutorials

Tuesday 12 March 2013

SAS INTERVIEWS CONCEPTUAL QUESTIONS V

We have a raw dataset:


Ball Price is : $700
Bat Price is: $800
Wicket Price is : $900

We have to make SAS data set as:

Product           Cost
--------         --------
Bat                   700
Ball                   800
Wicket              900

Kindly write your answer in comment box:

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

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

3 comments:

  1. Hi

    To get the output as given, please try the below code.

    data want;
    input @;
    product=scan(_infile_,1,' ');
    cost=compress(scan(_infile_,-1,' '),'$');
    cards;
    Ball Price is : $700
    Bat Price is: $800
    Wicket Price is : $900
    ;
    run;

    Thanks,
    Jagadish

    ReplyDelete
  2. data one;
    infile datalines;
    input name $ @': ' price dollar4.;
    datalines;
    Ball Price is : $700
    Bat Price is: $800
    Wicket Price is : $900
    run;
    proc print;
    run;

    you can use this code...

    ReplyDelete
  3. data costdat;
    input product $ @'$' cost;
    cards;
    Ball Price is : $700
    Bat Price is: $800
    Wicket Price is : $900
    ;
    run;


    you can use this code,this was very simple and logic

    ReplyDelete