comp.soft-sys.sas - The SAS statistics package.
Hello, I can't find how to get this result... I'd like to count the number of different persons in classes, in departments and in the whole organization. But one person can be in more than one class and in more than one department. In Oracle's SQL, I would write: SELECT year, department, class, COUNT(DISTINCT idnumber) AS nb FROM mytable GROUP BY ROLLUP(year, department, class); An example: id Year Dept Class ------------------------- 1 2000 Sci. Math 1 2000 Sci. Math 1 2000 Sci. Phy 1 2000 Letters French 2 2000 Sci. Phy 2 2000 Sci. Phy 3 2000 Letters French 3 2000 Letters Span. The result would give: Year Dept Class Nb ------------------------------ 2000 Sci Math 1 2000 Sci Phy 2 2000 Sci (total) 2 2000 Letters French 2 2000 Letters Span. 1 2000 Letters (total) 2 2000 (total) (total) 3 Thanks
I have a ginormous sql join job (data comes from 2,3 and 4 tables) what's the easiest way to first test the data, before actually letting it rip? the goal would be to first look at a very small piece (maybe thousand rows) but the actual job is dependent on joining tens of millions of rows from multiple tables subsetting may also (?) create a condition that nothing is created in output with too little data in the join to evaluate ie. proc sql (obs=1000); ...lots of create, select, where, having and containing statements or options obs=1000; proc sql ; ...lots of create, select, where, having and containing statements something totally different?
Hi, Is there any way to keep the first obs in each group in sql. I am looking for an sql way of doing below. Thank you. Cheers, Chang proc sort data=sashelp.class out=sorted; by sex name; run; data firstObs; set sorted; by sex name; if first.sex; run;