From: Yaw on
Dear all:

I have this data that has many undesirable repetitions of the
variables. I want to select one row of data per subject or delete the
other rows.

I tried proc sort with nodup but it does not seem to work.

Data have;
input subid survey meandose;
datalines;
311 36 0.90909
311 36 0.90909
207 1 0.1264
207 1 0.1264
207 1 0.1264
301 2 0.5064
;

proc print of data want;
311 36 0.90909
207 1 0.1264
301 2 0.5064

Any help with this will be appreciated.

Warm regards,
Yaw



From: vaibhavwadhera on
Hi Yaw

You can use the belwo code for the below results

Data have;
input subid survey meandose;
datalines;
311 36 0.90909
311 36 0.90909
207 1 0.1264
207 1 0.1264
207 1 0.1264
301 2 0.5064
;


proc print data =work.have;

Proc sort data =have out =hav1 nodupkeys;
by subid;
run;

proc print data =work.hav1;
run;


On Jul 5, 10:03 am, Yaw <link...(a)gmail.com> wrote:
> Dear all:
>
> I have this data that has many undesirable repetitions of the
> variables. I want to select one row of data per subject or delete the
> other rows.
>
> I tried proc sort with nodup but it does not seem to work.
>
> Data have;
> input subid survey meandose;
> datalines;
> 311                36        0.90909
> 311                36        0.90909
> 207                 1         0.1264
> 207                 1         0.1264
> 207                 1         0.1264
> 301                 2         0.5064
> ;
>
> proc print of data want;
> 311                36        0.90909
> 207                 1         0.1264
> 301                 2         0.5064
>
> Any help with this will be appreciated.
>
> Warm regards,
> Yaw

 | 
Pages: 1
Prev: Energy Saving Tips
Next: data merge query