Hi Arthur,
There is an option only for a single correct answer and 2 helpful answers.
Well I will leave it as it is.......
I put a "LIKE" to TOM,s ANSWER........
Cheers
HI PG,
I tried to solve this with the INDSNAME option. I get an error as shown below. Could you help me resolve.
Thanks
216 DATA FINAL(drop=percent rename=(percent1=Percent));
217 SET age_1 gender_2 BMI_2 CapriniScr_2 SrgrDrTm_2
218 ASAscr_2 CmbDbt_2 CmbSmk1_2 CmbCAD_2 CmbCncx_2
219 CmbHTN_2 CmbCOPD_2 Flp_flxCp_2 Flp_Necrosis_2
220 Flp_Infx_2 Flp_Thrbx_2 Flp_Seroma_2 Flp_Hmtma_2
221 Flp_Pathgn_2 Flp_Atbx_2 / INDSNAME=Group;
-
22
200
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, -, :, ;,
END, INDSNAME, KEY, KEYS, NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.
ERROR 200-322: The symbol is not recognized and will be ignored.
222 percent1=put(percent,6.2) || '%';
223 run;
Instead of the sum function:
group=sum(in1*1, in2*2, in3*3, in4*4, in5*5, in6*6 ,in7*7, in8*8, in9*9, in10*10, in11*11, in12*12,in13*13);
You could use:
group=find(cats(of in1-in13),'1');
This would give the same result.
Do not include the / in the SET statement.
You do not need to use a SUM() function, but you are are performing the sum of 13 numbers. Perhaps you are confusing the SUM() function with the SUM aggregation function available in PROC SQL?
In this case you could replace SUM() with normal addition operators between each of the calculated values. The difference between SUM(A,B) and A+B is when A or B is missing. The addition operator will generate missing result if either value is missing, but SUM() ignores the missing values. In this case since the only values included in your SUM() function call are 0/1 flag variables set by the IN= dataset options and constants there is no way that any of the values could be missing.
You can use the SUM() function:
group=sum(in1*1, in2*2, in3*3, in4*4, in5*5, in6*6 ,in7*7, in8*8, in9*9, in10*10, in11*11, in12*12,in13*13);
Or simple addition:
group=in1*1 + in2*2 + in3*3 + in4*4 + in5*5 + in6*6 + in7*7 + in8*8 + in9*9 + in10*10 + in11*11 + in12*12 + in13*13 ;
Or logic branching such as IF/THEN or SELECT logic:
if in1 then group=1;
if in2 then group=2;
...
if in13 then group=13;
Hi
I want to change the correct Answer from Reeza's to TOM. It has very detailed information. Otherwise Could anyone help me to give credit to two people at a time???
Thanks
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.