1
votes

I have date similar to something like,

Date          Rainfall     Highest_Tmp_Reached   Lowest_Tmp_Reached

1/5/93           5                10                    3
1/6/93           12                K                    K
1/2/95           K                 3                    4
..continued      ..                ..                   ..

K denotes missing values. I need to find the minimum rainfall,tmp reached and lowest tmp reached within my entire dataset, preferably as a summary (hence was trying to use a proc means). I also converted the data to numeric to make sure it would run(if thats the correct way to convert).

My attempt at PROC means:

DATA WORK.tempdata;
INFILE 'T:Data\tempdates.csv' 
DELIMITER = ',' MISSOVER DSD LRECL=32767 FIRSTOBS=2 ;
   INFORMAT date mmddyy10. ;
   INFORMAT rainfall $3.  ;
   INFORMAT highest_temp_reached $3.  ;
   INFORMAT lowest_temp_reached $4.  ;
   INPUT    date
            highest_temp_reached NUM
            lowest_temp_reached NUM
            rainfall NUM ;
RUN;
proc means data=WORK.tempdata min median max;
output out=WORK.tempdata min=min median=median max=max;
run;
PROC PRINT;
FORMAT DATE MMDDYY10.;
RUN;
1
I don't know what your question is. - Reeza
Your out dataset should take a different name otherwise you over write your initial data. Out=summary min=. And specify the variables in proc means via a var statement. - Reeza
Noted. Trying to find the min, max of the rainfall/temp columns. - Konfu Chicken
What does your log say when you run the code? - Reeza
It says theres some invalid line(where there are missing values, so I assume it's okay), but it still calculates something. It gives me a table with Minimum, Median, Max with incorrect numbers such as -167061,2200, 7800 which do not exist in the dataset. These numbers look like a cumulative sum. - Konfu Chicken

1 Answers

0
votes

Use the STACKODS option on proc means to get the table you want.

proc means data=WORK.tempdata min median max STACKODS;
Ods output summary=work.want;
run;

PROC PRINT data=want;
RUN;