<?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 generate a new variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/generate-a-new-variable/m-p/264680#M51957</link>
    <description>&lt;P&gt;Hello. I am doing an assignment in which I am supposed to extract and download CPS data from IPUMS site&amp;nbsp;&lt;/P&gt;&lt;P&gt;(&lt;A href="https://cps.ipums.org/cps-action/variables/group" target="_blank" rel="nofollow"&gt;https://cps.ipums.org/cps-action/variables/group&lt;/A&gt;). The variables in the data set are as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Person Record&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Core Demographic Variables&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AGE &lt;/STRONG&gt;Age&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SEX &lt;/STRONG&gt;Gender&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RACE&lt;/STRONG&gt; Race&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MARST&lt;/STRONG&gt; Marital status&lt;/P&gt;&lt;P&gt;&lt;U&gt;Ethnicity/Nativity Variables&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NATIVITY&lt;/STRONG&gt; Foreign birthplace or parentage&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HISPAN&lt;/STRONG&gt; Hispanic origin&lt;/P&gt;&lt;P&gt;&lt;U&gt;Education Variables&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EDUC99&lt;/STRONG&gt; Educational attainment, 1990 categories&lt;/P&gt;&lt;P&gt;&lt;U&gt;Work Variables&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WKSWORK1&lt;/STRONG&gt; Weeks worked last year&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UHRSWORK &lt;/STRONG&gt;Usual hours worked per week last year&lt;BR /&gt;&lt;STRONG&gt;UNION&lt;/STRONG&gt; Union status&lt;BR /&gt;&lt;STRONG&gt;PTWEEKS &lt;/STRONG&gt;Weeks working part time last year&lt;/P&gt;&lt;P&gt;&lt;U&gt;Income Variables&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;INCWAGE&lt;/STRONG&gt; Wage and salary income&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble executing a few steps that are required in the assignment. For example, it says to&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Generate a new variable for years of education using EDUC99 variable.&lt;/LI&gt;&lt;LI&gt;Generate a new variable for experience using AGE and EDUC99 variables.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;What would the code look like in order to do that? Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 18 Apr 2016 21:30:52 GMT</pubDate>
    <dc:creator>graingerad12</dc:creator>
    <dc:date>2016-04-18T21:30:52Z</dc:date>
    <item>
      <title>generate a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generate-a-new-variable/m-p/264680#M51957</link>
      <description>&lt;P&gt;Hello. I am doing an assignment in which I am supposed to extract and download CPS data from IPUMS site&amp;nbsp;&lt;/P&gt;&lt;P&gt;(&lt;A href="https://cps.ipums.org/cps-action/variables/group" target="_blank" rel="nofollow"&gt;https://cps.ipums.org/cps-action/variables/group&lt;/A&gt;). The variables in the data set are as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Person Record&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Core Demographic Variables&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AGE &lt;/STRONG&gt;Age&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SEX &lt;/STRONG&gt;Gender&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RACE&lt;/STRONG&gt; Race&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;MARST&lt;/STRONG&gt; Marital status&lt;/P&gt;&lt;P&gt;&lt;U&gt;Ethnicity/Nativity Variables&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;NATIVITY&lt;/STRONG&gt; Foreign birthplace or parentage&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HISPAN&lt;/STRONG&gt; Hispanic origin&lt;/P&gt;&lt;P&gt;&lt;U&gt;Education Variables&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EDUC99&lt;/STRONG&gt; Educational attainment, 1990 categories&lt;/P&gt;&lt;P&gt;&lt;U&gt;Work Variables&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WKSWORK1&lt;/STRONG&gt; Weeks worked last year&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;UHRSWORK &lt;/STRONG&gt;Usual hours worked per week last year&lt;BR /&gt;&lt;STRONG&gt;UNION&lt;/STRONG&gt; Union status&lt;BR /&gt;&lt;STRONG&gt;PTWEEKS &lt;/STRONG&gt;Weeks working part time last year&lt;/P&gt;&lt;P&gt;&lt;U&gt;Income Variables&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;INCWAGE&lt;/STRONG&gt; Wage and salary income&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having trouble executing a few steps that are required in the assignment. For example, it says to&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Generate a new variable for years of education using EDUC99 variable.&lt;/LI&gt;&lt;LI&gt;Generate a new variable for experience using AGE and EDUC99 variables.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;What would the code look like in order to do that? Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 21:30:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generate-a-new-variable/m-p/264680#M51957</guid>
      <dc:creator>graingerad12</dc:creator>
      <dc:date>2016-04-18T21:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: generate a new variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/generate-a-new-variable/m-p/264687#M51962</link>
      <description>&lt;P&gt;First, have you created a SAS data set?&lt;/P&gt;
&lt;P&gt;Also you will need to describe the contents of the variables you mention. I am guessing that the EDUC99 contains highest level of ecuation and looks something like "High School Graduate" or "GED", "Some college" "Trade school"&amp;nbsp;"Bachelor'd Degree" &amp;nbsp;or similar. In which case you could make some assumptions and use IF-THEN-ELSE (or SELECT-WHEN) to do something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; If Educ99 = "High School" then YearsEducation = 12;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; Else If Educ99 = "Bachelor's Degree" then YearsEducation=16;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*and so on, but without exact values and a reasonable interpretation then that skeleton code is all I'm going suggest.*/&lt;/P&gt;
&lt;P&gt;Run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without knowing what your specific uses of "experience" might be it gets a bit harder. Likely you could use values of your Age and YearsEducation combined with something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If age&amp;lt;18 and YearsEducation&amp;lt;12 then Experience = &amp;lt;some value&amp;gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 22:09:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/generate-a-new-variable/m-p/264687#M51962</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-18T22:09:50Z</dc:date>
    </item>
  </channel>
</rss>

