comp.soft-sys.sas - The SAS statistics package.
hi sas experts, i want grand total in this program data medi ; input sid visit dos $ nopts; datalines; 100 1 0.05mg 20 101 1 0.05mg 20 102 1 0.05mg 20 103 1 0.05mg 20 100 2 0.10mg 25 101 2 0.10mg 24 102 2 0.10mg 25 103 2 0.10mg 29 100 3 0.15mg 30 101 3 0.15mg 40 102 3 0.15mg 44 103 3 0.15mg 55 ; proc freq data=medi; table dos visit/nocum; weight nopts ; run;
I'm having trouble getting an output in a specific order. I have some 30 groups with 50 to 60 different types withing each group, each with a score associated with it. The data would look something like this (but in thousands) input group type score fruit mango 10 fruit banana 12 vegie carrot 22 vegie lettuce 55 vegie beet 4 dairy cow 1 dairy goat 2 ; I would like to sort based on the on the highest total for group and then have the types within group ordered in descending order. something like group type grand_total vegie lettuce 55 77 vegie carrot 22 77 fruit banana 12 22 . . . sql or base SAS are fine by me! TIA B.
Hey. I would like to sum all observations and all variables into one figure. I have a table with an unknown amount of variables and unknown variable_names and an unknown number of observations. I would like the total sum of all variables and all observations in this table (they are all numeric, and they all contain a number). I have tried different approaches with proc means, but nothing seems to help - hope you people out there can. (sample code woudl be appreaciated).
How is this possible? I run the following code: proc sql ; select sum(a='1') as Total from data ; quit ; and get a correct total but with a NEGATIVE sign? How can a test for a condition which yields a 0 or a 1 sum to a negative number? Data source is a MS Access data table where numbers are all stored as text. If I modify the syntax just a bit: proc sql ; select sum(strip(a)='1') as Total from data ; quit ; I get the same number but this time positive. How does STRIP function fix this paradox?