<?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 How can I create multiple branches in SAS? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-multiple-branches-in-SAS/m-p/847542#M335082</link>
    <description>&lt;P&gt;Hi SAS Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to multiple each record in my Have data set to derive Want data set (as show in the attached excel file).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have date set shown under Have sheet by multiple cutoff fields and want to introduce a new cutoff (under Cutoff - Columne "F") which is based on Type(col "B"),&lt;/P&gt;
&lt;P&gt;ideally this will multiple my each row into respective Cutoffs based on type.(see sheet "Cutoff based on type")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i created want data set for first 10 rows. with a new column New_policy_id which will be incremented or decreased depending on the cutoff value(col "F").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in a nut shell, for single record i would like to have new rows depending on the cutoffs + parent row(which is the original row) as shown in the want data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried different approaches and didnt seem to find a solutions, this looks so complicated, any help on this is huge thing for me.&lt;/P&gt;</description>
    <pubDate>Sat, 03 Dec 2022 04:22:21 GMT</pubDate>
    <dc:creator>PrudhviB</dc:creator>
    <dc:date>2022-12-03T04:22:21Z</dc:date>
    <item>
      <title>How can I create multiple branches in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-multiple-branches-in-SAS/m-p/847542#M335082</link>
      <description>&lt;P&gt;Hi SAS Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to multiple each record in my Have data set to derive Want data set (as show in the attached excel file).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have date set shown under Have sheet by multiple cutoff fields and want to introduce a new cutoff (under Cutoff - Columne "F") which is based on Type(col "B"),&lt;/P&gt;
&lt;P&gt;ideally this will multiple my each row into respective Cutoffs based on type.(see sheet "Cutoff based on type")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i created want data set for first 10 rows. with a new column New_policy_id which will be incremented or decreased depending on the cutoff value(col "F").&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in a nut shell, for single record i would like to have new rows depending on the cutoffs + parent row(which is the original row) as shown in the want data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried different approaches and didnt seem to find a solutions, this looks so complicated, any help on this is huge thing for me.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2022 04:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-multiple-branches-in-SAS/m-p/847542#M335082</guid>
      <dc:creator>PrudhviB</dc:creator>
      <dc:date>2022-12-03T04:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create multiple branches in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-multiple-branches-in-SAS/m-p/847545#M335083</link>
      <description>&lt;P&gt;Please show your example data as data step code and not in excel format.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2022 05:50:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-multiple-branches-in-SAS/m-p/847545#M335083</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2022-12-03T05:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create multiple branches in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-multiple-branches-in-SAS/m-p/847556#M335086</link>
      <description>&lt;P&gt;Please post example data in data steps with datalines, as you have been shown multiple times.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2022 07:38:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-multiple-branches-in-SAS/m-p/847556#M335086</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-03T07:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create multiple branches in SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-multiple-branches-in-SAS/m-p/847579#M335096</link>
      <description>&lt;P&gt;Don't share data as spreadsheets.&amp;nbsp; It is trivial to write a data step instead and much more descriptive and portable.&lt;/P&gt;
&lt;LI-SPOILER&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cutoff;
  row+1;
  input type :$1. Cutoff $20.;
  if type ne lag(type) then row=1;
cards;
a Parent
a &amp;lt;200
a &amp;gt;=200
b Parent
b &amp;lt;140
b 140 - 160
b &amp;gt;=160
c Parent
c &amp;lt;180
c &amp;gt;=180
d Parent
d &amp;lt;200
d &amp;gt;=200
e Parent
e &amp;lt;140
e 140 - 180
e &amp;gt;=180
;

data have ;
  input Record_key (type Region Reading_1 Reading_2 Cutoff Utilization Threshold tenure) ($)
        Policy_id
  ;
cards;
1 a &amp;lt;25 * * * * * * 1
2 a 25-50 &amp;lt;=500 * * * * &amp;lt;=2 2
3 a 25-50 &amp;lt;=500 * * * * &amp;gt;2 3
4 a &amp;gt;50 &amp;gt;850 * * * * * 4
5 a &amp;gt;50 &amp;lt;=657 * * * * * 5
6 b &amp;lt;25 * * * * * * 6
7 b 25-50 &amp;lt;=500 * * &amp;lt;=8 * * 7
8 b 25-50 &amp;gt;500 * * &amp;gt;8 * * 8
9 b &amp;gt;50 &amp;lt;=657 &amp;lt;=850 * * * * 9
10 b &amp;gt;50 &amp;lt;=657 &amp;gt;850 * * * * 10
11 b &amp;lt;25 &amp;lt;=714 * * * * * 11
12 b 25-50 &amp;lt;=500 * * * * * 12
13 c 25-50 &amp;gt;500 * * * * * 13
14 c &amp;gt;50 &amp;gt;850 * * * * * 14
15 c &amp;gt;50 &amp;lt;=657 * * * * * 15
16 c &amp;lt;25 * * * * * * 16
17 e 25-50 &amp;lt;=500 * * &amp;lt;=58 * * 17
18 e 25-50 &amp;lt;=500 * * &amp;gt;58 * * 18
19 e &amp;gt;50 &amp;gt;850 * * * * * 19
20 e &amp;gt;50 &amp;lt;=657 * * * * * 20
21 e &amp;lt;25 * * * * * * 21
22 e 25-50 &amp;lt;=500 &amp;lt;=946 * * * * 22
23 e 25-50 &amp;lt;=500 &amp;gt;946 * * * * 23
24 d &amp;gt;50 &amp;gt;850 * * * * * 24
25 d &amp;gt;50 &amp;lt;=657 * * * * * 25
26 d &amp;lt;25 * * * * * * 26
27 d 25-50 &amp;lt;=500 * * * &amp;lt;=13.5 * 27
28 d 25-50 &amp;lt;=500 * * * &amp;gt;13.5 * 28
29 d &amp;gt;50 &amp;gt;850 * * * * * 29
30 d &amp;gt;50 &amp;lt;=657 * * * * * 30
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI-SPOILER&gt;
&lt;P&gt;Looks to me like you just want to join the two tables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
create table want as 
  select * 
  from cutoff natural left join have(drop=Cutoff)
  order by policy_id, row
;
quit;

proc print;
 var policy_id row cutoff Region Reading_1 Reading_2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;       Policy_                                  Reading_    Reading_
OBS       id      row    Cutoff       Region       1           2

  1        1       1     Parent       &amp;lt;25        *           *
  2        1       2     &amp;lt;200         &amp;lt;25        *           *
  3        1       3     &amp;gt;=200        &amp;lt;25        *           *
  4        2       1     Parent       25-50      &amp;lt;=500       *
  5        2       2     &amp;lt;200         25-50      &amp;lt;=500       *
  6        2       3     &amp;gt;=200        25-50      &amp;lt;=500       *
  7        3       1     Parent       25-50      &amp;lt;=500       *
  8        3       2     &amp;lt;200         25-50      &amp;lt;=500       *
  9        3       3     &amp;gt;=200        25-50      &amp;lt;=500       *
 10        4       1     Parent       &amp;gt;50        &amp;gt;850        *
 11        4       2     &amp;lt;200         &amp;gt;50        &amp;gt;850        *
 12        4       3     &amp;gt;=200        &amp;gt;50        &amp;gt;850        *
 13        5       1     Parent       &amp;gt;50        &amp;lt;=657       *
 14        5       2     &amp;lt;200         &amp;gt;50        &amp;lt;=657       *
 15        5       3     &amp;gt;=200        &amp;gt;50        &amp;lt;=657       *
 16        6       1     Parent       &amp;lt;25        *           *
 17        6       2     &amp;lt;140         &amp;lt;25        *           *
 18        6       3     140 - 160    &amp;lt;25        *           *
 19        6       4     &amp;gt;=160        &amp;lt;25        *           *
 20        7       1     Parent       25-50      &amp;lt;=500       *
 21        7       2     &amp;lt;140         25-50      &amp;lt;=500       *
 22        7       3     140 - 160    25-50      &amp;lt;=500       *
 23        7       4     &amp;gt;=160        25-50      &amp;lt;=500       *
 24        8       1     Parent       25-50      &amp;gt;500        *
 25        8       2     &amp;lt;140         25-50      &amp;gt;500        *
...&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2022 16:17:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-create-multiple-branches-in-SAS/m-p/847579#M335096</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-12-03T16:17:00Z</dc:date>
    </item>
  </channel>
</rss>

