Last active
August 29, 2015 14:19
-
-
Save daynebatten/983394f1c02f5e382a41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Code below here should be run repeatedly until the data no longer changes... */ | |
| /* Suppress across the county dimension */ | |
| /* Put the data in order of degrees, and ascending number of citizens (missing sorts low in SAS) */ | |
| proc sort data = testset; | |
| by level degree num; | |
| run; | |
| data testset; | |
| /* Process data in groups by degree type */ | |
| set testset; | |
| by level degree; | |
| /* Keep track of number of suppressed data points from one observation to the next */ | |
| retain numsuppressed; | |
| /* Each time we hit a new degree type, set the number of suppressed cells for that group to 0 */ | |
| if first.degree = 1 then numsuppressed = 0; | |
| /* If the number of citizens isn't already suppressed, and there's only 1 suppressed cell for this group, | |
| we need to suppress this cell! */ | |
| if num ~= . and numsuppressed = 1 then num = .; | |
| /* Increment the suppression counter if the current cell is suppressed */ | |
| if num = . then numsuppressed = numsuppressed + 1; | |
| /* Keep the data clean */ | |
| drop numsuppressed; | |
| run; | |
| /* Suppress accross the degree dimension */ | |
| proc sort data = testset; | |
| by level county num; | |
| run; | |
| data testset; | |
| set testset; | |
| by level county; | |
| retain numsuppressed; | |
| if first.county = 1 then numsuppressed = 0; | |
| if num ~= . and numsuppressed = 1 then num = .; | |
| if num = . then numsuppressed = numsuppressed + 1; | |
| drop numsuppressed; | |
| run; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment