BookmarkSubscribeRSS Feed
vomer
Obsidian | Level 7

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?

6 REPLIES 6
art297
Opal | Level 21

Was there more to the error message, specifically, something like one of the variables wasn't found in the table?

vomer
Obsidian | Level 7

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?

art297
Opal | Level 21

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?

Doc_Duke
Rhodochrosite | Level 12

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

vomer
Obsidian | Level 7

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 Smiley Sad

Tom
Super User Tom
Super User

It is telling you the FIRST_DATE is a character variable.

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 6 replies
  • 1392 views
  • 0 likes
  • 4 in conversation