PROC MEANS

Reply
Contributor
Posts: 31

PROC MEANS

                                                                                                                                                                                 

im trying to do PROC MEANS  on variable SBP AND DBP but i keep getting error message. both of them contain missing values.

ERROR: Variable SBP in list does not match type prescribed for this list.

ERROR: Variable DBP in list does not match type prescribed for this list.

data crossoverdesign;                                                                                                                                                            

infile datalines delimiter=',';                                                                                                                                                  

input Id StdTyp Period Trtgrp Sysd1r1 Diasd1r1 Sysd1r2 Diasd1r2 Sysd1r3 Diasd1r3 Sysd2r1 Diasd2r1 Sysd2r2 Diasd2r2 Sysd2r3 Diasd2r3 Sysd3r1 Diasd3r1 Sysd3r2 Diasd3r2 Sysd3r3 Diasd3r3;

if Sysd1r1=999 then Sysd1r1=.;                                                                                                                                                   
if Diasd1r1=999 then Diasd1r1=.;                                                                                                                                                 
if Sysd1r2=999 then Sysd1r2=.;                                                                                                                                                   
if Diasd1r2=999 then Diasd1r2=.;                                                                                                                                                 
if Sysd1r3=999 then Sysd1r3=.;                                                                                                                                                   
if Diasd1r3=999 then Diasd1r3=.;                                                                                                                                                 
if Sysd2r1=999 then Sysd2r1=.;                                                                                                                                                   
datalines;                                                                                                                                                                       
3,1,1,1,134,82,122,80,118,80,112,76,130,84,120,82,114,76,104,74,114,76                                                                                                           
3,1,2,2,113,61,116,72,115,67,122,70,136,76,128,72,122,72,126,72,123,71                                                                                                           
4,2,1,3,142,90,134,88,134,84,122,76,116,76,114,74,122,84,124,78,116,80                                                                                                           
4,2,2,1,128,86,133,81,135,81,129,83,116,74,130,80,138,84,140,80,134,74                                                                                                           
5,1,1,1,134,78,138,84,126,80,122,74,120,76,122,78,140,82,134,84,136,84                                                                                                           
5,1,2,2,126,76,122,74,116,76,134,82,126,88,130,84,132,78,128,82,126,78                                                                                                           
8,2,1,3,112,72,114,70,116,70,120,78,122,76,116,76,118,72,113,75,113,73                                                                                                           
8,2,2,1,116,72,106,76,110,72,125,75,131,73,126,78,110,68,109,67,105,71                                                                                                           
9,1,1,2,116,70,112,72,108,70,124,70,110,70,112,74,114,78,120,72,116,76                                                                                                           
9,1,2,1,102,60,104,64,104,66,110,74,107,77,112,74,104,64,113,75,102,70                                                                                                           
10,1,1,2,109,73,107,77,104,80,110,74,114,74,110,74,119,79,119,75,112,80                                                                                                          
10,1,2,1,118,78,117,83,118,82,108,72,106,70,98,70,117,81,110,78,110,80                                                                                                           
14,1,1,1,116,64,97,61,100,60,118,73,125,77,119,69,106,70,107,73,110,70                                                                                                           
14,1,2,2,114,70,110,72,112,76,100,66,113,73,100,68,116,74,112,74,112,72                                                                                                          
22,3,1,2,122,78,114,76,114,72,110,76,102,68,105,73,116,68,106,66,106,72                                                                                                          
22,3,2,3,102,64,112,74,120,80,112,74,100,78,116,72,95,67,100,70,100,70                                                                                                           
25,3,1,2,102,60,94,62,94,66,96,62,103,65,103,61,110,70,121,71,125,77                                                                                                             
25,3,2,3,98,60,101,65,96,64,99,59,101,65,98,60,102,62,96,68,104,62                                                                                                               
27,1,1,2,126,80,130,80,120,78,122,80,128,74,122,82,128,78,121,77,123,77                                                                                                          
27,1,2,1,116,76,120,72,120,74,134,84,136,88,128,84,136,86,136,82,132,80                                                                                                          
29,1,1,1,111,67,110,72,106,66,95,65,105,65,104,62,96,58,98,64,100,60                                                                                                             
29,1,2,2,109,71,112,72,110,72,94,62,96,62,98,60,108,70,102,70,100,66                                                                                                             
30,3,1,3,110,62,111,61,99,55,110,62,110,62,112,62,104,64,104,64,108,60                                                                                                           
30,3,2,2,116,68,114,64,114,64,102,60,100,56,106,56,116,66,108,62,108,64                                                                                                          
31,2,1,3,134,82,136,72,128,72,130,80,131,73,129,75,134,82,132,78,132,74                                                                                                          
31,2,2,1,122,74,128,78,124,80,126,78,126,72,128,78,126,82,132,80,136,80                                                                                                          
32,2,1,1,114,66,106,68,106,66,122,72,130,74,124,76,118,62,121,77,116,72                                                                                                          
32,2,2,3,104,62,103,67,102,66,109,69,106,66,104,66,114,70,108,70,112,72                                                                                                          
33,1,1,1,156,86,154,76,144,86,148,88,140,88,142,86,144,90,132,86,140,86                                                                                                          
33,1,2,2,168,94,146,96,154,92,157,89,158,90,158,90,133,83,142,84,146,88                                                                                                          
34,1,1,2,122,76,116,74,116,76,127,77,114,72,114,70,126,72,116,66,118,72                                                                                                          
34,1,2,1,126,80,126,80,120,82,113,71,116,74,108,74,110,72,109,71,110,78                                                                                                          
35,1,1,2,98,64,98,70,98,68,108,66,106,76,104,70,102,64,96,70,100,66                                                                                                              
35,1,2,1,999,999,999,999,999,999,106,74,98,76,96,76,98,66,97,71,92,62                                                                                                            
36,2,1,1,96,60,104,66,94,64,100,70,100,74,106,74,96,64,92,62,93,59                                                                                                               
36,2,2,3,100,72,104,74,108,78,103,63,104,62,98,64,98,64,98,64,100,72                                                                                                             
37,1,1,2,118,74,114,70,112,68,110,72,110,70,113,69,116,76,122,76,116,74                                                                                                          
37,1,2,1,126,84,127,83,120,82,126,78,125,77,118,80,106,64,104,68,110,68                                                                                                          
39,3,1,2,128,86,124,84,126,84,132,80,130,86,134,82,114,74,112,74,112,82                                                                                                          
39,3,2,3,123,79,120,82,124,84,106,68,102,72,102,72,108,76,112,74,106,76                                                                                                          
40,2,1,3,96,64,106,70,99,67,110,60,96,62,86,60,98,62,92,60,91,63                                                                                                                 
40,2,2,1,121,77,118,76,116,82,104,68,107,69,108,76,99,75,98,64,98,70                                                                                                             
42,3,1,2,138,80,136,74,133,79,154,88,144,80,149,81,134,84,127,77,126,74                                                                                                          
42,3,2,3,126,76,125,75,121,73,130,76,118,80,118,68,132,74,118,70,126,74                                                                                                          
48,1,1,2,108,72,108,72,108,76,108,70,120,76,118,78,0,0,0,0,0,0                                                                                                                   
48,1,2,1,106,74,108,70,108,70,111,71,112,78,116,78,104,70,100,68,101,65                                                                                                          
49,3,1,3,90,62,94,64,86,60,90,60,92,60,86,56,86,58,87,59,90,60                                                                                                                   
49,3,2,2,88,64,88,60,92,66,86,60,94,60,92,64,88,56,92,62,92,62                                                                                                                   
50,1,1,1,114,68,106,66,106,70,100,66,100,70,105,63,112,64,98,64,110,64                                                                                                           
50,1,2,2,98,62,96,58,96,56,106,66,98,66,99,63,105,67,102,58,100,62                                                                                                               
52,2,1,3,129,67,120,68,130,72,121,67,118,66,114,68,114,70,111,67,114,68                                                                                                          
52,2,2,1,118,70,120,70,106,72,112,68,116,68,118,70,108,66,108,68,108,68                                                                                                          
53,1,1,2,112,84,112,82,114,84,110,76,110,74,112,78,112,88,114,84,114,84                                                                                                          
53,1,2,1,120,82,124,86,112,82,140,88,131,91,128,92,112,78,114,88,121,87                                                                                                          
57,1,1,2,124,82,132,84,132,90,118,70,120,80,110,72,130,80,138,80,131,79                                                                                                          
57,1,2,1,136,88,136,86,142,90,148,88,142,90,140,94,142,72,138,84,148,84                                                                                                          
58,3,1,2,94,74,98,66,86,68,102,70,98,66,90,64,86,64,96,66,94,66                                                                                                                  
58,3,2,3,102,66,100,74,96,68,96,70,103,73,99,73,102,74,100,68,94,68                                                                                                              
61,2,1,3,144,92,139,83,142,90,134,92,138,88,134,90,136,90,148,102,142,92                                                                                                         
61,2,2,1,146,94,144,92,149,93,138,92,126,90,128,92,134,90,132,90,124,88                                                                                                          
62,3,1,3,104,64,100,66,96,64,100,66,100,70,103,67,104,70,102,66,102,68                                                                                                           
62,3,2,2,106,70,108,68,98,74,106,70,102,68,102,70,103,65,100,64,96,64                                                                                                            
run;                                                                                                                                                                             
proc sort data=crossoverdesign;                                                                                                                                                  
by StdTyp Period;                                                                                                                                                                
run;                                                                                                                                                                             
data all;                                                                                                                                                                        
   set crossoverdesign;                                                                                                                                                          
   SBP= Sysd1r1||Sysd1r2||Sysd1r3||Sysd2r1||Sysd2r2||Sysd2r3||Sysd3r1||Sysd3r2||Sysd3r3;                                                                                 a        
   DBP= Diasd1r1||Diasd1r2||Diasd1r3||Diasd2r1||Diasd2r2||Diasd2r3||Diasd3r1||Diasd3r2||Diasd3r3;                                                                                
run;                                                                                                                                                                             
proc print data=all;                                                                                                                                                             
var SBP DBP;                                                                                                                                                                     
by StdTyp Period;                                                                                                                                                                
run;                                                                                                                                                                             
PROC SUMMARY DATA=all;                                                                                                                                                           
   BY StdTyp Period;                                                                                                                                                             
   VAR SBP DBP;                                                                                                                                                                  
RUN;                                                                                                                                                                             
proc print data=crossoverdesign;                                                                                                                                                 

run;

Super Contributor
Posts: 644

Re: PROC MEANS

You have (by default) defined SBP and DPB to be character variables in constructing table all.  The concatenation operator (||) implies a charactr process, and SAS automatically converts numeric data to character in such a case. Summary/Means is intended only for numeric variables.

Richard

Contributor
Posts: 31

Re: PROC MEANS

Posted in reply to RichardinOz

thanks. but what do i do? i needed to create SBP and DBP that way. is there a way to i convert them back?

Contributor
Posts: 31

Re: PROC MEANS

i mean back to numeric variables because i need to get summary statistics for them. thank you

Super Contributor
Posts: 644

Re: PROC MEANS

You do not specify what statistics you want so I suspect Proc Freq (counts and percentages) might be what you require.

Proc Freq data = all ;

     Tables SBP DBP SBP*DBP / List ;

Run ;

Richard

Contributor
Posts: 31

Re: PROC MEANS

Posted in reply to RichardinOz

i actually need the mean and standard deviations

Contributor
Posts: 31

Re: PROC MEANS

Posted in reply to RichardinOz

thanks a lot

Super Contributor
Posts: 644

Re: PROC MEANS

Means and standard deviations of the variables SBP DBP will be meaningless because even if converted back to numbers the resulting values will be beyond the range of numeric precision for SAS (15/16 digits in Windows and Unix).  I suspect then you need to analyse each component individually.

Proc means mean std data = all ;

     var Sysd: Diasd: ;

run ;

Richard

Super Contributor
Posts: 644

Re: PROC MEANS

Posted in reply to RichardinOz

Or perhaps you want the mean and standard deviation in each row?

data all;                                                                                                                                                                       
   set crossoverdesign;                                                                                                                                                         
   SBPmean = mean(Sysd1r1, Sysd1r2, Sysd1r3, Sysd2r1, Sysd2r2, Sysd2r3, Sysd3r1, Sysd3r2, Sysd3r3);                                                                                 a       

   DBPmean = mean (Diasd1r1, Diasd1r2, Diasd1r3, Diasd2r1, Diasd2r2, Diasd2r3, Diasd3r1, Diasd3r2, Diasd3r3);    

     

   SBPsdt = std(Sysd1r1, Sysd1r2, Sysd1r3, Sysd2r1, Sysd2r2, Sysd2r3, Sysd3r1, Sysd3r2, Sysd3r3);                                                                                 a       
   DBPstd = std (Diasd1r1, Diasd1r2, Diasd1r3, Diasd2r1, Diasd2r2, Diasd2r3, Diasd3r1, Diasd3r2, Diasd3r3);                                                                               

run;  

Richard

Contributor
Posts: 31

Re: PROC MEANS

Posted in reply to RichardinOz

yea, thats a better idea. ill try that

Ask a Question
Discussion stats
  • 9 replies
  • 255 views
  • 6 likes
  • 2 in conversation