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

Hi I want to bring some data into SAS using 'Datalines' option.

 

Example of the syntax is copied into programme window. Can someone tell what's wrong with the syntax and how can I correct it please?

 

data CMC;
input Study: $32	Location: $32	Sample 9.  Numbers_CCC 8.;
datalines
;

Akenroye    	US      	1415721  	125774
Batra       	Australia	1184        	 916
Berry2013   	US	        200656    	 95736
Berry2017   	US      	1850027  	980514
Blackburn   	US      	141709    	46764
Cecil   	        Europe  	7831633   	1722959
Dosa        	US	        251	                113
Edelson     	US      	241540848	410619
Feinstein   	US      	144385188	2887704
Phelan      	US      	193500000	10062000
;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

Hi @sks521  Please notice the change in the input statement with Informats with a period(.) as suffix and not having an explicit informat to read numbers for variables sample and numbers_ccc

 

input Study: $32.	Location: $32.	Sample   Numbers_CCC ;
data CMC;
input Study: $32.	Location: $32.	Sample   Numbers_CCC ;
datalines
;

Akenroye    	US      	1415721  	125774
Batra       	Australia	1184        	 916
Berry2013   	US	        200656    	 95736
Berry2017   	US      	1850027  	980514
Blackburn   	US      	141709    	46764
Cecil   	        Europe  	7831633   	1722959
Dosa        	US	        251	                113
Edelson     	US      	241540848	410619
Feinstein   	US      	144385188	2887704
Phelan      	US      	193500000	10062000
;
run;

View solution in original post

7 REPLIES 7
novinosrin
Tourmaline | Level 20

Hi @sks521  Please notice the change in the input statement with Informats with a period(.) as suffix and not having an explicit informat to read numbers for variables sample and numbers_ccc

 

input Study: $32.	Location: $32.	Sample   Numbers_CCC ;
data CMC;
input Study: $32.	Location: $32.	Sample   Numbers_CCC ;
datalines
;

Akenroye    	US      	1415721  	125774
Batra       	Australia	1184        	 916
Berry2013   	US	        200656    	 95736
Berry2017   	US      	1850027  	980514
Blackburn   	US      	141709    	46764
Cecil   	        Europe  	7831633   	1722959
Dosa        	US	        251	                113
Edelson     	US      	241540848	410619
Feinstein   	US      	144385188	2887704
Phelan      	US      	193500000	10062000
;
run;
sks521
Quartz | Level 8

Hi,

 

This step brings the data in correctly but when I want to perform calculations involving 'Sample' and 'Numbers_CCC' variables for example in the code on here; it gives me this message;

 


145 data CMC;
146 alpha = 0.05;
147 L = 1 - betainv(1 - alpha/2,Sample-Numbers_CCC+1,Numbers_CCC);
148 U = betainv(1 - alpha/2,Numbers_CCC+1 ,Sample-Numbers_CCC);
149 put L= U=;
150 run;

NOTE: Variable Numbers_CCC is uninitialized.
NOTE: Variable Sample is uninitialized.
L=. U=.
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
1 at 147:7 1 at 147:9 1 at 147:35 1 at 147:47 1 at 148:5 1 at 148:36
1 at 148:46
NOTE: The data set WORK.CMC has 1 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

sks521
Quartz | Level 8

Posting the syntax on here;

data CMC;
alpha = 0.05;
L = 1 - betainv(1 - alpha/2,Sample-Numbers_CCC+1,Numbers_CCC);
U = betainv(1 - alpha/2,Numbers_CCC+1 ,Sample-Numbers_CCC);
put L= U=;
run;
novinosrin
Tourmaline | Level 20

Hi @sks521  okay, So basically you are trying to do the following

 

1. Read a set of raw datalines and create a SAS dataset

2. Using the dataset created, do some manipulation.

 

So 1. is complete now as the read and create part is done

 

For 2. You need a SET statement to read the dataset records that you created for manipulation and any more processing like

data CMC_2;
set cmc;
data CMC2;
set cmc;/*notice here*/ alpha = 0.05; L = 1 - betainv(1 - alpha/2,Sample-Numbers_CCC+1,Numbers_CCC); U = betainv(1 - alpha/2,Numbers_CCC+1 ,Sample-Numbers_CCC); put L= U=; run;

 

sks521
Quartz | Level 8

Thanks but it still doesn't perform any calculations. For example you could tell that I want to calculate upper and lower confidence limits for each study proportion but I get this message;

 

151 data numeric;
152 set CMC;
153 alpha = 0.05;
154 L = 1 - betainv(1 - alpha/2,Sample-Numbers_CCC+1,Numbers_CCC);
155 U = betainv(1 - alpha/2,Numbers_CCC+1 ,Sample-Numbers_CCC);
156 put L= U=;
157 run;

L=. U=.
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
1 at 154:7 1 at 154:9 1 at 154:35 1 at 154:47 1 at 155:5 1 at 155:36
1 at 155:46
NOTE: There were 1 observations read from the data set WORK.CMC.
NOTE: The data set WORK.NUMERIC has 1 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds

 

 

novinosrin
Tourmaline | Level 20

@sks521  Here is my test and the LOG report. Plz take a look

data CMC;
input Study: $32.	Location: $32.	Sample   Numbers_CCC ;
datalines
;

Akenroye    	US      	1415721  	125774
Batra       	Australia	1184        	 916
Berry2013   	US	        200656    	 95736
Berry2017   	US      	1850027  	980514
Blackburn   	US      	141709    	46764
Cecil   	        Europe  	7831633   	1722959
Dosa        	US	        251	                113
Edelson     	US      	241540848	410619
Feinstein   	US      	144385188	2887704
Phelan      	US      	193500000	10062000
;
run;

data CMC2;
set cmc;
alpha = 0.05;
L = 1 - betainv(1 - alpha/2,Sample-Numbers_CCC+1,Numbers_CCC);
U = betainv(1 - alpha/2,Numbers_CCC+1 ,Sample-Numbers_CCC);
put L= U=;
run;
LOG:
1025  data CMC2;
1026  set cmc;
1027  alpha = 0.05;
1028  L = 1 - betainv(1 - alpha/2,Sample-Numbers_CCC+1,Numbers_CCC);
1029  U = betainv(1 - alpha/2,Numbers_CCC+1 ,Sample-Numbers_CCC);
1030  put L= U=;
1031  run;

L=0.0883727737 U=0.0893108111
L=0.7487263591 U=0.7972035916
L=0.4749274859 U=0.4793033005
L=0.5292803219 U=0.5307192491
L=0.3275519989 U=0.3324553819
L=0.2197098846 U=0.220290256
L=0.3875709568 U=0.5140174366
L=0.0016948068 U=0.0017052015
L=0.0199771721 U=0.0200228505
L=0.0519687208 U=0.0520312926
NOTE: There were 10 observations read from the data set WORK.CMC.
NOTE: The data set WORK.CMC2 has 10 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.04 seconds
sks521
Quartz | Level 8

Working fine now. Thanks

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 7 replies
  • 598 views
  • 1 like
  • 2 in conversation