comp.soft-sys.sas - The SAS statistics package.
Error log below requires a numeric argument for sum function while all values are numeric according to the Proc contents: 399 Proc SQL ; 400 Create Table PR As 401 Select region, sum(patients) as sumtot_patient, 402 sum(covered) as sumtot_covered, 403 sum(member_months) as sumtot_mm 404 From bhi.PR_sub 405 Group By region; ERROR: The SUM summary function requires a numeric argument. ERROR: The following columns were not found in the contributing tables: member_months. 406 Quit ; # Variable Type Len 4 allowed Num 8 3 covered Num 8 2 patients Num 8 1 region Char 23 What I am doing wrong? How can I fix my code? Could you please give me a hand? Thank you in advance, Irin
I am bringing in some survey data from survey monkey, so it is all in text format. To make it easier to work with I'm trying to switch everything to numeric. I have recoded all of my variables in the same manner as the example below, but each time I try to run it I get an error that says: NOTE: Invalid argument to function INPUT at line 11070 column 7. I have gone through the frequencies of my old variables and they have all been changed, although the freq tables look a little funny with the variable values a little lower than the descriptive statistics on the page (I think this is due to the fact that they are numbers but in a character format). I have seen the suggestions that others have posted regarding this error, that there is still something character that is left in the variable, but can't find anything. Does anyone have any suggestions?? Thanks so much, Alison **here is a sample of the way I am recoding to numeric and then formatting into a numeric variable: data apa; set surveys.apa; options nofmterr; If In_what_state_do_you_work____che = 'Connecticut' then In_what_state_do_you_work____che = 1; else if In_what_state_do_you_work____che = 'Maine' then In_what_state_do_you_work____che = 2; else if In_what_state_do_you_work____che = 'Massachusetts' then In_what_state_do_you_work____che = 3; else if In_what_state_do_you_work____che = 'New Hampshire' then In_what_state_do_you_work____che = 4; else if In_what_state_do_you_work____che = 'Rhode Island' then In_what_state_do_you_work____che = 5; else if In_what_state_do_you_work____che = 'Vermont' then In_what_state_do_you_work____che = 6; else In_what_state_do_you_work____che = 0; State = input(In_what_state_do_you_work____che,best4.);
Hello All. This is the entire error message: Invalid argument to function DATEJUL at line 14 column 14. 1 1 - - -5 4 CHAR .&..D ..SYA4..=BC ZONE 0500C400EECF03B NUMR 100040012814047 CODE: =20 DATA DCOL; =20 INFILE DCOL; =20 INPUT @05 DCURCTYP $CHAR2. @;=20 IF DCURCTYP =3D: 'D'; =20 INPUT @25 DCDDSNAM $CHAR44. =20 @79 DCDVOLSR $CHAR6. =20 @89 DCDALLSP PIB4. =20 @93 DCDUSESP PIB4. =20 @105 DCDCREDT PD4. =20 @113 DCDLSTRF PD4.; =20 CRDATE=3DDATEJUL(DCDCREDT); FORMAT CRDATE MMDDYY8.; RUN; Why am I getting the above message? Why is SAS looking at DATJUL in = column 14 when the dates are in columns 105 and 113? TIA, ~~Carol =20 =20
Hi, I am writing a macro in which I want to determine the maximum value of a set of variables from a set of merged datasets where the number of datasets can vary. The gist of my problem can be seen in this example: %macro test(N); data total; run; *% generate and merge the example datasets here; %do I = 1 %to &N.; data rand&I.; do c = 1 to 10; a&I. = uniform(-1); output; end; run; data total; merge total rand&I.; run; %end; *% here is the problem...I want to be able to vary the number of arguments in max automatically; data max; set total; max = max(a1, a2, a3, a4, a5); run; proc print;run; %mend; %test(5); In other words, how can I calculate the max of a varying number of arguments in this macro, namely a1, a2, ...aN, where N is any positive integer. Thanks Tomislav