BookmarkSubscribeRSS Feed
AAdi_18
Calcite | Level 5

USUBJID

AGE

TRT

DRUG

1001001

45

active   

carbidopa

1001002

56

placebo

dummy

1001003

49

placebo

dummy

1001004

38

active   

Combination

1001005

40

placebo

dummy

1001006

46

active   

Combination

1001007

50

active   

levodopa

1001008

55

active   

Combination

 

1) From the above data:

a) Create a dataset “DEMOG”.

b) Create a dataset “DEMOG_2” and represent the data in the variable drug as follows

    alisporivir = “Drug A”

     Ribavirin = “Drug B”

     Combination = “Drug A + Drug B”

     Dummy = “Null”

c) Create a dataset “DEMOG_3” with female subjects receiving active treatment.

d) Create a dataset “DEMOG_4” with subjects whose age is greater than or equal to 40. (#Hint: Either >= or GE can be used)

 

 

 

 

hi frnds, i'm just a beginner. i have tried these querries. Can anyone pls explain for the options b, c & d.Thanks.

5 REPLIES 5
Reeza
Super User
Since this is homework I'll only give some hints. Good Luck.
b) Look into a format
c) IF statement
d) WHERE statement
AAdi_18
Calcite | Level 5

ya, i tried but i didn't find the solution.Can u please explain?

AAdi_18
Calcite | Level 5

/*a)*/
data DEMOG;
length DRUG $11;
input USUBJID AGE TRT$ DRUG$;
cards;
1001001 45 active carbidopa
1001002 56 placebo dummy
1001003 49 placebo dummy
1001004 38 active Combination
1001005 40 placebo dummy
1001006 46 active Combination
1001007 50 active levodopa
1001008 55 active Combination
;
proc print data=DEMOG;
run;

 

/*b)*/

data DEMOG_2;
length DRUG $32;
input USUBJID AGE TRT$ DRUG$;
format carbidopa = “Drug A”
levodopa = “Drug B”
Combination = “Drug A + Drug B”
Dummy = “Null”;
cards;
1001001 45 active carbidopa
1001002 56 placebo dummy
1001003 49 placebo dummy
1001004 38 active Combination
1001005 40 placebo dummy
1001006 46 active Combination
1001007 50 active levodopa
1001008 55 active Combination
;
proc print data=DEMOG_2;
run;

Reeza
Super User
Look at PROC FORMAT not the format statement.
ballardw
Super User

Additional hint on C: Where is the gender information stored?

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5 replies
  • 874 views
  • 0 likes
  • 3 in conversation