<?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: Producing frequency table and a new variable conditional to the last reading of the variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Producing-frequency-table-and-a-new-variable-conditional-to-the/m-p/531459#M145458</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;, Thank you for asking more clarification. I am attaching the dataset and the following is an example for what I want.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26711iB87A9741BBA10A41/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Based on the attached image, there are two values for SUPERSTRUCTURE_COND_059 of STRUCTURE_NUMBER_008 =00000000000H311. That is, SUPERSTRUCTURE_COND_059=9 which is repeated two times, and SUPERSTRUCTURE_COND_059=8 which is repeated 22 times as shown in&amp;nbsp;Frequency Count column. I want to generate a variable called CENSOR to have&amp;nbsp; a value of 1 for SUPERSTRUCTURE_COND_059=9 with Frequency_count =2, and CENSOR=0 for SUPERSTRUCTURE_COND_059=8 with Frequenency_count=22 becuase SUPERSTRUCTURE_COND_059=8 is the last observation for&amp;nbsp; STRUCTURE_NUMBER_008=00000000000H311.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similarly, There are three values for SUPERSTRUCTURE_COND_059 of STRUCTURE_NUMBER_008=00000000000P403. That is, 6 which is repeated 13 times, 5 which is repeated 10 times, and 3 which is repeated 1 time as shown in Frequency_count column. Here, I want the variable CENSOR=1 for SUPERSTRUCTURE_COND_059=6 and SUPERSTRUCTURE_COND_059=5, and CENSOR =0 for SUPERSTRUCTURE_COND_059=3 because the SUPERSTRUCTURE_COND_059=3 is the last observation for&amp;nbsp; STRUCTURE_NUMBER_008=00000000000P403.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The attached is the dataset that I want to work with.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached the file that I created the frequncy_column, but the original file is psc_post02 that I referred in my first post.&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jan 2019 20:34:17 GMT</pubDate>
    <dc:creator>mmhxc5</dc:creator>
    <dc:date>2019-01-30T20:34:17Z</dc:date>
    <item>
      <title>Producing frequency table and a new variable conditional to the last reading of the variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Producing-frequency-table-and-a-new-variable-conditional-to-the/m-p/531430#M145441</link>
      <description>&lt;P&gt;Hi dear programmers,&lt;/P&gt;&lt;P&gt;I have a dataset of over 100,000 rows and three variables. The variables are;&lt;/P&gt;&lt;P&gt;STRUCTURE_NUMBER_008&lt;/P&gt;&lt;P&gt;SUPERSTRUCTURE_COND_059, and&lt;/P&gt;&lt;P&gt;Inspection_Year&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SUPERSTRUCTURE_COND_059 gets value from 9 to 0 and any value can be repeated, STRUCTURE_NUMBER_008 is the ID for a bridge, and the inspecto_year is self explanatory and get value from 1992 to 2017.&amp;nbsp;&lt;/P&gt;&lt;P&gt;STRUCTURE_NUMBER_008 can enter and leave any time between 1992 to 2017.&lt;/P&gt;&lt;P&gt;The dataset is sorted based on STRUCTURE_NUMBER_008 and Inspection_Year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to generate a frequency table of&amp;nbsp; STRUCTURE_NUMBER_008*SUPERSTRUCTURE_COND_059 condional to the following criteria.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the frequency STRUCTURE_NUMBER_008*SUPERSTRUCTURE_COND_059 counts any row except the last reading of STRUCTURE_NUMBER_008 and SUPERSTRUCTURE_COND_059 I want a variable call it CENSOR to be generated as 1, and if the frequency STRUCTURE_NUMBER_008*SUPERSTRUCTURE_COND_059 counts the last row of STRUCTURE_NUMBER_008 and SUPERSTRUCTURE_COND_059 the variable CENSOR to be generated as 0.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be grateful of your time and help for writing a code to do the job.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know if more explanation or if the data set is required.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 16:48:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Producing-frequency-table-and-a-new-variable-conditional-to-the/m-p/531430#M145441</guid>
      <dc:creator>mmhxc5</dc:creator>
      <dc:date>2019-01-30T16:48:20Z</dc:date>
    </item>
    <item>
      <title>Re: Producing frequency table and a new variable conditional to the last reading of the variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Producing-frequency-table-and-a-new-variable-conditional-to-the/m-p/531431#M145442</link>
      <description>&lt;P&gt;You will get a better and likely quicker result if you provide a small example data set with data similar to your actual data&amp;nbsp;and what you want for the result, in actual values, given that example data set.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 16:51:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Producing-frequency-table-and-a-new-variable-conditional-to-the/m-p/531431#M145442</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-30T16:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Producing frequency table and a new variable conditional to the last reading of the variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Producing-frequency-table-and-a-new-variable-conditional-to-the/m-p/531459#M145458</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;, Thank you for asking more clarification. I am attaching the dataset and the following is an example for what I want.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26711iB87A9741BBA10A41/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Based on the attached image, there are two values for SUPERSTRUCTURE_COND_059 of STRUCTURE_NUMBER_008 =00000000000H311. That is, SUPERSTRUCTURE_COND_059=9 which is repeated two times, and SUPERSTRUCTURE_COND_059=8 which is repeated 22 times as shown in&amp;nbsp;Frequency Count column. I want to generate a variable called CENSOR to have&amp;nbsp; a value of 1 for SUPERSTRUCTURE_COND_059=9 with Frequency_count =2, and CENSOR=0 for SUPERSTRUCTURE_COND_059=8 with Frequenency_count=22 becuase SUPERSTRUCTURE_COND_059=8 is the last observation for&amp;nbsp; STRUCTURE_NUMBER_008=00000000000H311.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Similarly, There are three values for SUPERSTRUCTURE_COND_059 of STRUCTURE_NUMBER_008=00000000000P403. That is, 6 which is repeated 13 times, 5 which is repeated 10 times, and 3 which is repeated 1 time as shown in Frequency_count column. Here, I want the variable CENSOR=1 for SUPERSTRUCTURE_COND_059=6 and SUPERSTRUCTURE_COND_059=5, and CENSOR =0 for SUPERSTRUCTURE_COND_059=3 because the SUPERSTRUCTURE_COND_059=3 is the last observation for&amp;nbsp; STRUCTURE_NUMBER_008=00000000000P403.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The attached is the dataset that I want to work with.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached the file that I created the frequncy_column, but the original file is psc_post02 that I referred in my first post.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 20:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Producing-frequency-table-and-a-new-variable-conditional-to-the/m-p/531459#M145458</guid>
      <dc:creator>mmhxc5</dc:creator>
      <dc:date>2019-01-30T20:34:17Z</dc:date>
    </item>
  </channel>
</rss>

