BookmarkSubscribeRSS Feed
270992
Calcite | Level 5

Requirement

 

Read the raw data file dat with list input to create the sas Permanent data set Treatment and create the variables from raw data file in following order.

 

Patient_Trial_ID(Numeric) >> Treatment (Character) >> Dosing_Instruction (Character)

 

Now Ensure that your new dataset contains only 3 Variables and 15 Observations.

 

Raw Data

 

1 Palcebo "Dosing with 240ml Distilled water"
2 "Active Drug" "Dosing with 240ml Glucose Water"
3 "Active Drug" "Dosing with 240ml Glucose Water"
4 "Palcebo" "Dosing with 240ml distilled water"
5 "Active Drug" "Dosing with 240ml Glucose Water"
6 "Palcebo" "Dosing with 240ml distilled water"
7 "Active Drug" "Dosing with 240ml Glucose Water"
8 "Palcebo" "Dosing with 240ml distilled water"
9 "Palcebo" "Dosing with 240ml distilled water"
10 "Active Drug" "Dosing with 240ml Glucose Water"
11 "Active Drug" "Dosing with 240ml Glucose Water"
12 "Palcebo" "Dosing with 240ml distilled water"
13 "Active Drug" "Dosing with 240ml Glucose Water"
14 "Palcebo" "Dosing with 240ml distilled water"
15 "Active Drug" "Dosing with 240ml Glucose Water"

 

Can any one sugess me with best answer

2 REPLIES 2
Reeza
Super User

What do you have so far? This really looks like homework as well, so you should give it a try. 

 


@270992 wrote:

Requirement

 

Read the raw data file dat with list input to create the sas Permanent data set Treatment and create the variables from raw data file in following order.

 

Patient_Trial_ID(Numeric) >> Treatment (Character) >> Dosing_Instruction (Character)

 

Now Ensure that your new dataset contains only 3 Variables and 15 Observations.

 

Raw Data

 

1 Palcebo "Dosing with 240ml Distilled water"
2 "Active Drug" "Dosing with 240ml Glucose Water"
3 "Active Drug" "Dosing with 240ml Glucose Water"
4 "Palcebo" "Dosing with 240ml distilled water"
5 "Active Drug" "Dosing with 240ml Glucose Water"
6 "Palcebo" "Dosing with 240ml distilled water"
7 "Active Drug" "Dosing with 240ml Glucose Water"
8 "Palcebo" "Dosing with 240ml distilled water"
9 "Palcebo" "Dosing with 240ml distilled water"
10 "Active Drug" "Dosing with 240ml Glucose Water"
11 "Active Drug" "Dosing with 240ml Glucose Water"
12 "Palcebo" "Dosing with 240ml distilled water"
13 "Active Drug" "Dosing with 240ml Glucose Water"
14 "Palcebo" "Dosing with 240ml distilled water"
15 "Active Drug" "Dosing with 240ml Glucose Water"

 

Can any one sugess me with best answer


 

ballardw
Super User

Please show the code you used. I suspect that you only need to add a DSD option to an infile statement;

 

data have;
   infile datalines dlm=' ' dsd missover;
   informat row best. cat $20. dose $50.;
   input row cat dose;
datalines;
1 Palcebo "Dosing with 240ml Distilled water"
2 "Active Drug" "Dosing with 240ml Glucose Water"
3 "Active Drug" "Dosing with 240ml Glucose Water"
4 "Palcebo" "Dosing with 240ml distilled water"
5 "Active Drug" "Dosing with 240ml Glucose Water"
6 "Palcebo" "Dosing with 240ml distilled water"
7 "Active Drug" "Dosing with 240ml Glucose Water"
8 "Palcebo" "Dosing with 240ml distilled water"
9 "Palcebo" "Dosing with 240ml distilled water"
10 "Active Drug" "Dosing with 240ml Glucose Water"
11 "Active Drug" "Dosing with 240ml Glucose Water"
12 "Palcebo" "Dosing with 240ml distilled water"
13 "Active Drug" "Dosing with 240ml Glucose Water"
14 "Palcebo" "Dosing with 240ml distilled water"
15 "Active Drug" "Dosing with 240ml Glucose Water"
;
run;

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