<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: complete a dataset with stadardized lines in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/complete-a-dataset-with-stadardized-lines/m-p/640453#M21743</link>
    <description>&lt;P&gt;It is not clear whether you are adding the same items of if the things you need to add vary from time to time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is always the same stuff then you could consider creating a permanent data set then append the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the list changes from time to time but always needs the same items because of periodic "missing" you should build a data set of all the needed values. Then depending on some other issues, such as are these key values duplicated in the other set you could use a Merge to bring the data together with the standard set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Apr 2020 14:25:26 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-04-16T14:25:26Z</dc:date>
    <item>
      <title>complete a dataset with stadardized lines</title>
      <link>https://communities.sas.com/t5/New-SAS-User/complete-a-dataset-with-stadardized-lines/m-p/640447#M21742</link>
      <description>&lt;P&gt;hello dear SAS experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I often have to add new lines such as the following ones to an existing dataset that has the same structure. I use the following code. The dataset Filialstruktur1 is completed by the dataset Filialstruktur_Ergaenzung.&lt;/P&gt;&lt;P&gt;From time to time, I have to add new datalines to the Filialstruktur_Ergaenzung dataset.&lt;/P&gt;&lt;P&gt;A dataline is based on 2 parameters for example here 91100 and 'FIL1':&lt;/P&gt;&lt;P&gt;MARKTREGION_BT = 'FIL1' ; NLHB_BT = &lt;STRONG&gt;91100&lt;/STRONG&gt; ; NLBEZ_BT = 'FIL1' ; MBRHB_BT = &lt;STRONG&gt;91100&lt;/STRONG&gt; ; MBRBEZ_BT_DASHB = 'FIL1' ; FILHB_BT = &lt;STRONG&gt;91100&lt;/STRONG&gt; ; FILBEZ_BT_DASHB = 'FIL1' ; FILHB_BT_EC = '91100' ; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question: &lt;STRONG&gt;how can I do better?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sort&lt;/STRONG&gt; data=Filialstruktur1; by filhb_bt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; Filialstruktur_Ergaenzung ;&lt;/P&gt;&lt;P&gt;length MARKTREGION_BT $&lt;STRONG&gt;35&lt;/STRONG&gt; NLHB_BT $&lt;STRONG&gt;5&lt;/STRONG&gt; NLBEZ_BT $&lt;STRONG&gt;35&lt;/STRONG&gt; MBRHB_BT $&lt;STRONG&gt;5&lt;/STRONG&gt; MBRBEZ_BT_DASHB $&lt;STRONG&gt;40&lt;/STRONG&gt; FILHB_BT $&lt;STRONG&gt;5&lt;/STRONG&gt; FILBEZ_BT_DASHB $&lt;STRONG&gt;40&lt;/STRONG&gt; ;&lt;/P&gt;&lt;P&gt;MARKTREGION_BT = 'FIL1' ; NLHB_BT = &lt;STRONG&gt;91100&lt;/STRONG&gt; ; NLBEZ_BT = 'FIL1' ; MBRHB_BT = &lt;STRONG&gt;91100&lt;/STRONG&gt; ; MBRBEZ_BT_DASHB = 'FIL1' ; FILHB_BT = &lt;STRONG&gt;91100&lt;/STRONG&gt; ; FILBEZ_BT_DASHB = 'FIL1' ; FILHB_BT_EC = '91100' ; output;&lt;/P&gt;&lt;P&gt;MARKTREGION_BT = 'Vermittler' ; NLHB_BT = &lt;STRONG&gt;99991&lt;/STRONG&gt; ; NLBEZ_BT = 'Vermittler' ; MBRHB_BT = &lt;STRONG&gt;99991&lt;/STRONG&gt; ; MBRBEZ_BT_DASHB = 'Vermittler' ; FILHB_BT = &lt;STRONG&gt;99991&lt;/STRONG&gt; ; FILBEZ_BT_DASHB = 'Vermittler' ; FILHB_BT_EC = '99991' ; output;&lt;/P&gt;&lt;P&gt;MARKTREGION_BT = 'FIL2' ; NLHB_BT = &lt;STRONG&gt;99993&lt;/STRONG&gt; ; NLBEZ_BT = 'FIL2' ; MBRHB_BT = &lt;STRONG&gt;99993&lt;/STRONG&gt; ; MBRBEZ_BT_DASHB = 'FIL2' ; FILHB_BT = &lt;STRONG&gt;99993&lt;/STRONG&gt; ; FILBEZ_BT_DASHB = 'FIL2' ; FILHB_BT_EC = '99993' ; output;&lt;/P&gt;&lt;P&gt;MARKTREGION_BT = 'Online' ; NLHB_BT = &lt;STRONG&gt;99992&lt;/STRONG&gt; ; NLBEZ_BT = 'Online' ; MBRHB_BT = &lt;STRONG&gt;99992&lt;/STRONG&gt; ; MBRBEZ_BT_DASHB = 'Online' ; FILHB_BT = &lt;STRONG&gt;99992&lt;/STRONG&gt; ; FILBEZ_BT_DASHB = 'Online' ; FILHB_BT_EC = '99992' ; output;&lt;/P&gt;&lt;P&gt;MARKTREGION_BT = 'FIL3' ; NLHB_BT = &lt;STRONG&gt;99994&lt;/STRONG&gt; ; NLBEZ_BT = 'FIL3' ; MBRHB_BT = &lt;STRONG&gt;99994&lt;/STRONG&gt; ; MBRBEZ_BT_DASHB = 'FIL3' ; FILHB_BT = &lt;STRONG&gt;99994&lt;/STRONG&gt; ; FILBEZ_BT_DASHB = 'FIL3' ; FILHB_BT_EC = '99994' ; output;&lt;/P&gt;&lt;P&gt;MARKTREGION_BT = 'FIL4' ; NLHB_BT = &lt;STRONG&gt;99995&lt;/STRONG&gt; ; NLBEZ_BT = 'FIL4' ; MBRHB_BT = &lt;STRONG&gt;99995&lt;/STRONG&gt; ; MBRBEZ_BT_DASHB = 'FIL4' ; FILHB_BT = &lt;STRONG&gt;99995&lt;/STRONG&gt; ; FILBEZ_BT_DASHB = 'FIL4' ; FILHB_BT_EC = '99995' ; output;&lt;/P&gt;&lt;P&gt;MARKTREGION_BT = 'Nicht_zustellbar' ; NLHB_BT = &lt;STRONG&gt;99999&lt;/STRONG&gt; ; NLBEZ_BT = 'Nicht_zustellbar' ; MBRHB_BT = &lt;STRONG&gt;99999&lt;/STRONG&gt; ; MBRBEZ_BT_DASHB = 'MBR Nicht zustellbar' ; FILHB_BT = &lt;STRONG&gt;99999&lt;/STRONG&gt; ; FILBEZ_BT_DASHB = 'Nicht_zustellbar' ; FILHB_BT_EC = '99999' ; output;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; Filialstruktur_Ergaenzt;&lt;/P&gt;&lt;P&gt;set Filialstruktur1 Filialstruktur_Ergaenzung;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 14:01:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/complete-a-dataset-with-stadardized-lines/m-p/640447#M21742</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2020-04-16T14:01:11Z</dc:date>
    </item>
    <item>
      <title>Re: complete a dataset with stadardized lines</title>
      <link>https://communities.sas.com/t5/New-SAS-User/complete-a-dataset-with-stadardized-lines/m-p/640453#M21743</link>
      <description>&lt;P&gt;It is not clear whether you are adding the same items of if the things you need to add vary from time to time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is always the same stuff then you could consider creating a permanent data set then append the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the list changes from time to time but always needs the same items because of periodic "missing" you should build a data set of all the needed values. Then depending on some other issues, such as are these key values duplicated in the other set you could use a Merge to bring the data together with the standard set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 14:25:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/complete-a-dataset-with-stadardized-lines/m-p/640453#M21743</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-16T14:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: complete a dataset with stadardized lines</title>
      <link>https://communities.sas.com/t5/New-SAS-User/complete-a-dataset-with-stadardized-lines/m-p/640456#M21744</link>
      <description>&lt;P&gt;You can just use INPUT statement and inline data (as long as it is NOT inside of a macro definition).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Filialstruktur_Ergaenzung ;
  length MARKTREGION_BT $35 NLHB_BT $5 NLBEZ_BT $35 MBRHB_BT $5 
         MBRBEZ_BT_DASHB $40 FILHB_BT $5 FILBEZ_BT_DASHB $40 
  ;
  infile datalines dsd dlm='|' truncover;
  input MARKTREGION_BT -- FILBEZ_BT_DASHB ;
datalines4;
FIL1|91100|FIL1|91100|FIL1|91100|FIL1|91100
Vermittler|99991|Vermittler|99991|Vermittler|99991|Vermittler|99991
FIL2|99993|FIL2|99993|FIL2|99993|FIL2|99993
Online|99992|Online|99992|Online|99992|Online|99992
FIL3|99994|FIL3|99994|FIL3|99994|FIL3|99994
FIL4|99995|FIL4|99995|FIL4|99995|FIL4|99995
Nicht_zustellbar|99999|Nicht_zustellbar|99999|MBR Nicht zustellbar|99999|Nicht_zustellbar|99999
;;;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to make a dataset with similar structure to an existing dataset then instead of the LENGTH statement to define the variables you can use a SET statement reading the existing dataset.&amp;nbsp; You can put the SET in an always false IF/THEN and it won't actually read any of the data, but it create the variables properly.&amp;nbsp; Then you can just input using DATALINES (aka CARDS).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Filialstruktur_Ergaenzung ;
  if 0 then set Filialstruktur1 ;
  infile datalines dsd dlm='|' truncover;
  input (_all_) (+0);
datalines4;
FIL1|91100|FIL1|91100|FIL1|91100|FIL1|91100
Vermittler|99991|Vermittler|99991|Vermittler|99991|Vermittler|99991
FIL2|99993|FIL2|99993|FIL2|99993|FIL2|99993
Online|99992|Online|99992|Online|99992|Online|99992
FIL3|99994|FIL3|99994|FIL3|99994|FIL3|99994
FIL4|99995|FIL4|99995|FIL4|99995|FIL4|99995
Nicht_zustellbar|99999|Nicht_zustellbar|99999|MBR Nicht zustellbar|99999|Nicht_zustellbar|99999
;;;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could even combine your two data steps.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Filialstruktur_Ergaenzt;
  do until (eof);
    set Filialstruktur_Ergaenzung end=eof;
    output;
  end;
  infile datalines dsd dlm='|' truncover;
  do while(1=1);
    input MARKTREGION_BT -- FILBEZ_BT_DASHB ;
    output;
  end;
datalines4;
FIL1|91100|FIL1|91100|FIL1|91100|FIL1|91100
Vermittler|99991|Vermittler|99991|Vermittler|99991|Vermittler|99991
FIL2|99993|FIL2|99993|FIL2|99993|FIL2|99993
Online|99992|Online|99992|Online|99992|Online|99992
FIL3|99994|FIL3|99994|FIL3|99994|FIL3|99994
FIL4|99995|FIL4|99995|FIL4|99995|FIL4|99995
Nicht_zustellbar|99999|Nicht_zustellbar|99999|MBR Nicht zustellbar|99999|Nicht_zustellbar|99999
;;;;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Apr 2020 14:28:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/complete-a-dataset-with-stadardized-lines/m-p/640456#M21744</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-04-16T14:28:54Z</dc:date>
    </item>
  </channel>
</rss>

