How to create a new dataset only duplicate observations in
proc sort procedure?



How to create a new dataset only duplicate observations in proc sort procedure?..

Answer / Rahul Kumar Mishra

To create a new dataset with duplicate observations using the `PROC SORT` procedure in SAS, you can use the `OBS=COUNT(*)` option in the PROC SORT step. Here's an example:nn```sqlnDATA new_dataset; nSET old_dataset; nBY variable1 variable2...; nRUN; nPROC SORT DATA = new_dataset OUT = duplicates; nBY variable1 variable2...; nOBS = COUNT(*); nRUN; nDATA final_dataset; nMERGE new_dataset (RENAME=(variable1=new_var1 new_variable2=new_var2 ...)) n duplicates (RENAME=(variable1=old_var1 old_variable2=old_var2 ...)); nBY variable1 variable2...; nRUN; n```nThis code creates a new dataset named `new_dataset` with duplicate observations and then merges it with the original dataset containing unique observations to produce the final dataset.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Programming Languages AllOther Interview Questions

How will you prove that java swing is multithreaded?

1 Answers  


the channel in the data communication model can be? option a.postal mail serv. b telephon lines c.radio signals d. all the above

2 Answers   iNautix, National Investment Commission,


hi this is uday i want prepare for nic exam if any one have previous question papers please send me or atlest guide me how to prepare my ID is udaykiran4u@in.com

1 Answers  


Why multiple inheritance is removed in java?

4 Answers   TCS,


< DL Compact > tag is used for

1 Answers  


What is meant byStatic Variable ?

7 Answers   Mascot,


Number of null pointers in any binary tree

5 Answers   Infosys,


Full from of MP3?

2 Answers  


What language / script is used to validate web page

3 Answers  


What is the first message line that any language learning prints on the screen? and why?

1 Answers  


4. What is the need of START 0? Instead if can we use any other numeric? If we use what will happen?

1 Answers   TCS,


what is the BAM? where we can use it in BizTalk server?

1 Answers  


Categories