BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Criptic
Lapis Lazuli | Level 10

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Darrell_sas
SAS Employee

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...

View solution in original post

2 REPLIES 2
Darrell_sas
SAS Employee

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...

Criptic
Lapis Lazuli | Level 10

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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

How to Concatenate Values

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 822 views
  • 0 likes
  • 2 in conversation