BookmarkSubscribeRSS Feed
manya92
Fluorite | Level 6

What is the difference between 

 

proc sql ;

     create table 1 as

    select DISTINCT enrolid, age, sex

    from have 

quit ;

 

VS

 

 

proc sql ;

     create table 2 as

    select  enrolid, age, sex

    from have 

quit ;

 

 

 

VS

 

proc sql ;

     create table 3 as

    select DISTINCT enrolid

    from have 

quit ;

 

 

Q1. Will i get different no. of observations for each of these datasets? If yes why ?

 

Q2. What is the difference between these three .

 

Thanks

3 REPLIES 3
ballardw
Super User

Run the code and see. Create data if needed, include some duplicate rows.

Reeza
Super User

You should mock up some data and test your code. Here's some mock data for you. Run it against each of the tables and see what you're results are. Note that the first table has duplicates and the second does not. 

 

data have1;
set sashelp.class;
enrolid = _n_;
if _n_ in (1, 5, 9) then output;
output;
keep enrolid age sex;
run;

data have2;
set sashelp.class;
enrolid = _n_;
keep enrolid age sex;
run;



@manya92 wrote:

What is the difference between 

 

proc sql ;

     create table 1 as

    select DISTINCT enrolid, age, sex

    from have 

quit ;

 

VS

 

 

proc sql ;

     create table 2 as

    select  enrolid, age, sex

    from have 

quit ;

 

 

 

VS

 

proc sql ;

     create table 3 as

    select DISTINCT enrolid

    from have 

quit ;

 

 

Q1. Will i get different no. of observations for each of these datasets? If yes why ?

 

Q2. What is the difference between these three .

 

Thanks


 

manya92
Fluorite | Level 6
will try. thanks

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 621 views
  • 1 like
  • 3 in conversation