Hi there,
I keep getting an error for the following code -> Function MIN requires a numeric expression as argument 1.
Code:
proc sql;
create table TEST as
select ID,
min(min(FIRST_Date, information_date)) as First_V2,
max(LAST_Date)as Last_V2
from base
group by ID;
quit;
Can someone tell me what I am doing wrong?
Was there more to the error message, specifically, something like one of the variables wasn't found in the table?
Hi Art, just one more line after that message :
ERROR: The following columns were not found in the contributing tables: First_V2.
but I don't get this line as this is the variable I am creating using the min statement?
I would look at the log more closely. I would guess that it would be stipulating either first_date, last_date, or information_date. One of those appears to not exist in your data. If you do a proc contents on the input data do all three show up?
Vomer,
Your error is in the syntax for the summary function min. You have used the syntax for the MIN function from the DATA step instead of the summary function syntax required by PROC SQL.
The summary function MIN has one argument, not two. Review the documentation in the PROC SQL manual. You got it right for the MAX summary function, but I can't tell what you are trying to do in the expression that starts "min(min(" .
Doc Muhlbaier
Duke
all those data set exist guys. I am trying to get the cumulative min of the 2 variables : FIRST_Date, information_date
If I just do min (FIRST_Date, information_date) then it does not give me that which is why I tried the min (min() approach... but it is not working
It is telling you the FIRST_DATE is a character variable.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.