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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 877 views
  • 0 likes
  • 3 in conversation