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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.