BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sathwik
Calcite | Level 5

How to write Randomization Program   

 

 

 

 

 

Thank you

Sathwik

1 ACCEPTED SOLUTION
13 REPLIES 13
andreas_lds
Jade | Level 19

Have a look at proc surveyselect if you want to select observations randomly. If you have something else in mind, post more details of the task you have to solve.

sathwik
Calcite | Level 5

data x;
input EMP_ID 9-12 NAME $ 17-30 DEPARTMENT $ 33-35 DESIGNEE $ 41-55;
datalines;
101 abc CL Manager
102 xyz BR Manager
103 hrx PB Manager
104 gt QA Manager
105 asd HR Manager
106 klm FD Manager
107 jrs CL Manager
108 gk CL Asst.Manager
109 krk CL Asst.Manager
110 zip BR Asst.Manager
111 qmo QA Asst.Manager
112 srk CL Associate
113 mkp CL Associate
114 rzo CL Sr.Associate
115 sec CL Sr.Associate
116 ns BR Sr.Associate
117 bza QA Sr.Associate
118 pko CL Jr.Associate
119 amp CL Jr.Associate
120 mr CL Jr.Associate
121 dr CL Jr.Associate
122 kump PB Jr.Associate
123 pn QA Jr.Associate
124 bj CL Trinee
125 bt CL Trinee
126 mc CL Trinee
127 ab BR Trinee
128 Sa BR Trinee
129 ya BR Trinee
130 vya BR Trinee
131 eek QA Trinee
;
run;

proc print data = x;
run;
andreas_lds
Jade | Level 19

grafik.png

 

When you post a new message the table show above is displayed. Please read the checklist and provide what is missing.

sathwik
Calcite | Level 5

data x; input EMP_ID 9-12 NAME $ 17-30 DEPARTMENT $ 33-35 DESIGNEE $41-55; datalines; 101 abc CL Manager 102 xyz BR Manager 103 hrx PB Manager 104 gt QA Manager 105 asd HR Manager 106 klm FD Manager 107 jrs CL Manager 108 gk CL Asst.Manager 109 krk CL Asst.Manager 110 zip BR Asst.Manager 111 qmo QA Asst.Manager 112 srk CL Associate 113 mkp CL Associate 114 rzo CL Sr.Associate 115 sec CL Sr.Associate 116 ns BR Sr.Associate 117 bza QA Sr.Associate 118 pko CL Jr.Associate 119 amp CL Jr.Associate 120 mr CL Jr.Associate 121 dr CL Jr.Associate 122 kump PB Jr.Associate 123 pn QA Jr.Associate 124 bj CL Trinee 125 bt CL Trinee 126 mc CL Trinee 127 ab BR Trinee 128 Sa BR Trinee 129 ya BR Trinee 130 vya BR Trinee 131 eek QA Trinee ; run; proc print data = x; run;

 

How to make randomization for this program

andreas_lds
Jade | Level 19

Please don't double-post questions.We are willing to help, but you have to explain what you need.

 

First post regarding the same problem: https://communities.sas.com/t5/SAS-Programming/How-to-write-Randomization-Program/m-p/495582

sathwik
Calcite | Level 5
ok

I'm trying for how to do randomization for this program
andreas_lds
Jade | Level 19

Randomize what?

Reeza
Super User

What do you mean by randomization?

  • Do you want to randomly sort the data?
  • Do you want to randomly select some data? If so is it with replacement? How many? Are there any rules for selection?
  • Do you want to randomly delete data?
  • Do you want to randomly add data?

The list goes on and on and on....so you need to provide significantly more details.

 

Vague unspecific questions will get a vague unspecific answer such as use PROC SURVEYSELECT or the RAND function.

If you need some more detailed instructions on how to ask a good question please read this post:

https://stackoverflow.com/help/how-to-ask

 

 

sathwik
Calcite | Level 5
Yeah I mean how to do randomly sort the data
and how to add data randomly.




thank you
sathwik
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Please avoid putting data indented from the left hand side, as mentioned on several occasions before.  SAS reads directly from position 1, hence you do not need indetations or positional reads!!

 

I refer you to my post:

Consult the How to post a question, found just under the post button.  Provide some information.

At a guess you can use the:

Rand() function: https://blogs.sas.com/content/iml/2011/08/24/how-to-generate-random-numbers-in-sas.html

Or

Surveyselect: https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#surveyselect_toc.h...

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Consult the How to post a question, found just under the post button.  Provide some information.

At a guess you can use the:

Rand() function: https://blogs.sas.com/content/iml/2011/08/24/how-to-generate-random-numbers-in-sas.html

Or

Surveyselect: https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#surveyselect_toc.h...

sathwik
Calcite | Level 5
How to add data randomly

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 13 replies
  • 1388 views
  • 0 likes
  • 4 in conversation