<?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: SAS PROGRAMMING QUESTION in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-PROGRAMMING-QUESTION/m-p/305992#M65366</link>
    <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I am not sure what you are looking for when you ask for an ANSWER to your program. In the first program, you read 4 observations and WORK.A has 4 observations and 1 variable or column called ID, as shown in the screen shot below. Your program that creates WORK.B has 3 explicit OUTPUT statements and makes 3 new variables, ID1, ID2, and, ID3. There are no controls in the program to restrict when OUTPUT occurs, so for EVERY observation in WORK.A, you will write 3 observations into WORK.B, for a total of 12 observations, as shown below. The variables in WORK.B are ID, ID1, ID2 and ID3, but for every row, the values are the same as for the original value of ID, so if you look at the PROC PRINT for WORK.B you will see that observations 1-3 are all for ID=1; observations 4-6 are all for ID=2; observations 7-9 are for ID=3 and observations 10-12 are for ID=4. I suspect this is not what you want.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5381i061575B81FF40F78/image-size/original?v=v2&amp;amp;px=-1" alt="compare_a_b.png" title="compare_a_b.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; The program is working as written, so there is nothing to ANSWER. Is there something wrong with the output as shown in WORK.B? Did you need some other structure to the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I wonder whether you wanted something more like this:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5382i6CEDC1A8CABFDC1A/image-size/original?v=v2&amp;amp;px=-1" alt="possible_alternative_transpose.png" title="possible_alternative_transpose.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;Where the 4 observations from WORK.A were restructured to be only 1 observation with numbered values that corresponded to the original values from WORK.A (so ID1=1, ID2=2, etc).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are 2 ways to restructure WORK.A -- one is to use PROC TRANSPOSE and the other is to use a DATA step program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthai&lt;/P&gt;</description>
    <pubDate>Thu, 20 Oct 2016 16:25:39 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2016-10-20T16:25:39Z</dc:date>
    <item>
      <title>SAS PROGRAMMING QUESTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-PROGRAMMING-QUESTION/m-p/305975#M65360</link>
      <description>&lt;P&gt;Please help me in explaning the answer of following program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;input id;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;3&lt;/P&gt;&lt;P&gt;4&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data b;&lt;/P&gt;&lt;P&gt;set a;&lt;/P&gt;&lt;P&gt;id1=id;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;id2=id;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;id3=id;&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 15:24:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-PROGRAMMING-QUESTION/m-p/305975#M65360</guid>
      <dc:creator>ROHINISDAS</dc:creator>
      <dc:date>2016-10-20T15:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS PROGRAMMING QUESTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-PROGRAMMING-QUESTION/m-p/305992#M65366</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I am not sure what you are looking for when you ask for an ANSWER to your program. In the first program, you read 4 observations and WORK.A has 4 observations and 1 variable or column called ID, as shown in the screen shot below. Your program that creates WORK.B has 3 explicit OUTPUT statements and makes 3 new variables, ID1, ID2, and, ID3. There are no controls in the program to restrict when OUTPUT occurs, so for EVERY observation in WORK.A, you will write 3 observations into WORK.B, for a total of 12 observations, as shown below. The variables in WORK.B are ID, ID1, ID2 and ID3, but for every row, the values are the same as for the original value of ID, so if you look at the PROC PRINT for WORK.B you will see that observations 1-3 are all for ID=1; observations 4-6 are all for ID=2; observations 7-9 are for ID=3 and observations 10-12 are for ID=4. I suspect this is not what you want.&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5381i061575B81FF40F78/image-size/original?v=v2&amp;amp;px=-1" alt="compare_a_b.png" title="compare_a_b.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; The program is working as written, so there is nothing to ANSWER. Is there something wrong with the output as shown in WORK.B? Did you need some other structure to the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I wonder whether you wanted something more like this:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5382i6CEDC1A8CABFDC1A/image-size/original?v=v2&amp;amp;px=-1" alt="possible_alternative_transpose.png" title="possible_alternative_transpose.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;Where the 4 observations from WORK.A were restructured to be only 1 observation with numbered values that corresponded to the original values from WORK.A (so ID1=1, ID2=2, etc).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are 2 ways to restructure WORK.A -- one is to use PROC TRANSPOSE and the other is to use a DATA step program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthai&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 16:25:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-PROGRAMMING-QUESTION/m-p/305992#M65366</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-10-20T16:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS PROGRAMMING QUESTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-PROGRAMMING-QUESTION/m-p/306265#M65466</link>
      <description>Thank you for replying cynthai.&lt;BR /&gt;&lt;BR /&gt;I know that code is perfectly right. I only want to know the logic behind&lt;BR /&gt;the output.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Rohini S Das&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Fri, 21 Oct 2016 12:37:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-PROGRAMMING-QUESTION/m-p/306265#M65466</guid>
      <dc:creator>ROHINISDAS</dc:creator>
      <dc:date>2016-10-21T12:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: SAS PROGRAMMING QUESTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-PROGRAMMING-QUESTION/m-p/306322#M65483</link>
      <description>Hi:&lt;BR /&gt;  As I explained in my first post:&lt;BR /&gt;"In the first program, you read 4 observations and WORK.A has 4 observations and 1 variable or column called ID, as shown in the screen shot below. Your program that creates WORK.B has 3 explicit OUTPUT statements and makes 3 new variables, ID1, ID2, and, ID3. There are no controls in the program to restrict when OUTPUT occurs, so for EVERY observation in WORK.A, you will write 3 observations into WORK.B, for a total of 12 observations, as shown below. The variables in WORK.B are ID, ID1, ID2 and ID3, but for every row, the values are the same as for the original value of ID, so if you look at the PROC PRINT for WORK.B you will see that observations 1-3 are all for ID=1; observations 4-6 are all for ID=2; observations 7-9 are for ID=3 and observations 10-12 are for ID=4. I suspect this is not what you want."&lt;BR /&gt;&lt;BR /&gt;The first program is writing out 3 observations for every single observation in work.a.&lt;BR /&gt;&lt;BR /&gt;cynthia</description>
      <pubDate>Fri, 21 Oct 2016 15:11:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-PROGRAMMING-QUESTION/m-p/306322#M65483</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2016-10-21T15:11:41Z</dc:date>
    </item>
  </channel>
</rss>

