So I want to remove an internal border in my map data set, which I imported from a shape file. It is based on the German zip code and I want to now visualize some insurance zones on top of it. These zones are intermixed with each other, but they never overlap. After I joined my zones to the imported data set everything seems to be fine, everything as a zone and the number of entries doesn't change. Then I use PROC SORT to sort the new joined data set by the insurance zones - again everything seems to be fine. Then in my last step I use PROC GREMOVE and this where things go downhill, the number of entries reduces by about 200.000 and I have no idea why. I am posting the code below with it (hoping my formatting isn't to awful this is my first time posting). Thanks in advance for any help you can give me. &DETAIL is a macro variable that includes the specific insurance zone which the user can specify.
/*This dummy is need because the zones are always in a zip code range*/
DATA PLZ_DUMMY(KEEP=plz);
x=0;
DO WHILE(x LE 99999);
plz=PUT(x,z5.);
OUTPUT;
x=x+1;
END;
RUN;
/*Here I join my dummy table with the table that includes the insurance zones*/
PROC SQL;
CREATE TABLE GDV_ZONEN AS
SELECT a.plz, b.&DETAIL
FROM PLZ_DUMMY a
LEFT JOIN kwh_dim.vgv_gdv_tarifzonen b
ON a.plz BETWEEN b.plz_von and b.plz_bis;
QUIT;
/*Here I Left Join my imported data set which is based on the zip code with the data set which includes the zones*/
PROC SQL;
CREATE TABLE GDV_ZONEN_KOR AS
SELECT kb.*, gz.&DETAIL
FROM KARTEN_BASIS kb
LEFT JOIN GDV_ZONEN gz
ON kb.plz = gz.plz;
QUIT;
/*Sorting*/
PROC SORT DATA=GDV_ZONEN_KOR OUT=GDV_ZONEN_SORT;
BY &DETAIL;
RUN;
/*Removing the old ID and setting the zone as the new ID - I think*/
PROC GREMOVE DATA=GDV_ZONEN_SORT OUT=MAP_DATA;
ID ID;
BY &DETAIL;
RUN;
I can't tell what you are doing without the data, but the following example seems to be the same thing that you are trying to do: http://support.sas.com/documentation/cdl/en/graphref/67288/HTML/default/viewer.htm#p0zr4d6x9xv72tn13...
I can't tell what you are doing without the data, but the following example seems to be the same thing that you are trying to do: http://support.sas.com/documentation/cdl/en/graphref/67288/HTML/default/viewer.htm#p0zr4d6x9xv72tn13...
Thanks, it seems that when I use MERGE I have no problems with the fragmentation so something most have been of with my JOIN. Thanks for the response.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.