Hi Channel,
I am trying to run the following code but not getting identical results
please advice
This is what I have:
PROC SORT DATA = A OUT = B;
BY T;
QUIT;
This is what I want:
PROC SQL;
CREATE TABLE B AS SELECT *
FROM A
GROUP BY T
ORDER BY T
;
QUIT;
Thanks
Can you post a sample data for folks to test plz
PROC SQL does not guarantee the order of the observations as they are read in. It can very well read observations from A in a different order than they appear within A.
PROC SORT does guarantee the incoming order is the same as the order in A. However, there is a further complication depending on whether the option EQUALS (usually the default) or NOEQUALS is in effect.
If the observations take on unique values for T, you will always get the same result. If there might be multiple observations for the same value of T, you can get different results. In both cases, the output will be sorted by T. But within identical values of T, the order can be different.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.