<?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 why variable did not get created in data cleaning? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/why-variable-did-not-get-created-in-data-cleaning/m-p/189465#M265982</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi! I have a question about why a variable I created is not being read.&amp;nbsp; In the following program, I create the dataset partic_cln from partic.&amp;nbsp; In one of the steps, I'd like to create a binary variable NoServices (line 1048) and then at the end of my cleaning, make sure to drop all records for which NoServices=1.&amp;nbsp; Do you know why this is not working?&amp;nbsp; My code is below. Many thanks in advance! 1033&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data partic_cln (drop = name); 1034&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set partic; 1035&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1036&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *Clean Participant Last Name, First Name; 1037&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastname_prs = propcase(scan(name,1,",")); 1038&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firstname_prs = strip(propcase(scan(name,2,","))); 1039&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1040&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *Creating a copy of Participant Last, First Name to preserve for the link file; 1041&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastname_prs_link = propcase(scan(name,1,",")); 1042&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firstname_prs_link = strip(propcase(scan(name,2,","))); 1043&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1044&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* NoServices is a 0/1 variable created to flag ISIS participants who were RA'd but never 1044&amp;nbsp;&amp;nbsp;&amp;nbsp; ! received services. 1045&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Records flagged as one may still appear in PRS extracts and the BIF.&amp;nbsp; For example, 1045&amp;nbsp;&amp;nbsp;&amp;nbsp; ! B_unique_ID1 IL10491 is a participant 1046&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; who has been RA'd but does not receive services.&amp;nbsp; He/she is still in BIF file, however.*/ 1047&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1048&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NoServices=0; 1049&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if B_unique_ID1="IL10491" then NoServices=1; 1050&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1051&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *Include PRS hardcodes program; 1052&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %include "S:\Projects\ISIS\Admin Data\PRS\02 Programs\prs_clean01_prs bif hardcode.sas"/. . . NOTE: %INCLUDE (level 1) ending. ERROR: Variable NoServices is not on file WORK.PARTIC. 1145&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1146&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where NoServices ne 1; 1147&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Oct 2014 15:08:29 GMT</pubDate>
    <dc:creator>Maisha_Huq</dc:creator>
    <dc:date>2014-10-17T15:08:29Z</dc:date>
    <item>
      <title>why variable did not get created in data cleaning?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-variable-did-not-get-created-in-data-cleaning/m-p/189465#M265982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi! I have a question about why a variable I created is not being read.&amp;nbsp; In the following program, I create the dataset partic_cln from partic.&amp;nbsp; In one of the steps, I'd like to create a binary variable NoServices (line 1048) and then at the end of my cleaning, make sure to drop all records for which NoServices=1.&amp;nbsp; Do you know why this is not working?&amp;nbsp; My code is below. Many thanks in advance! 1033&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data partic_cln (drop = name); 1034&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set partic; 1035&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1036&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *Clean Participant Last Name, First Name; 1037&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastname_prs = propcase(scan(name,1,",")); 1038&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firstname_prs = strip(propcase(scan(name,2,","))); 1039&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1040&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *Creating a copy of Participant Last, First Name to preserve for the link file; 1041&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lastname_prs_link = propcase(scan(name,1,",")); 1042&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firstname_prs_link = strip(propcase(scan(name,2,","))); 1043&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1044&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* NoServices is a 0/1 variable created to flag ISIS participants who were RA'd but never 1044&amp;nbsp;&amp;nbsp;&amp;nbsp; ! received services. 1045&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Records flagged as one may still appear in PRS extracts and the BIF.&amp;nbsp; For example, 1045&amp;nbsp;&amp;nbsp;&amp;nbsp; ! B_unique_ID1 IL10491 is a participant 1046&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; who has been RA'd but does not receive services.&amp;nbsp; He/she is still in BIF file, however.*/ 1047&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1048&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NoServices=0; 1049&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if B_unique_ID1="IL10491" then NoServices=1; 1050&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1051&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *Include PRS hardcodes program; 1052&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %include "S:\Projects\ISIS\Admin Data\PRS\02 Programs\prs_clean01_prs bif hardcode.sas"/. . . NOTE: %INCLUDE (level 1) ending. ERROR: Variable NoServices is not on file WORK.PARTIC. 1145&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1146&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where NoServices ne 1; 1147&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 15:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-variable-did-not-get-created-in-data-cleaning/m-p/189465#M265982</guid>
      <dc:creator>Maisha_Huq</dc:creator>
      <dc:date>2014-10-17T15:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: why variable did not get created in data cleaning?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-variable-did-not-get-created-in-data-cleaning/m-p/189466#M265983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to reformat that code so it's readable...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 15:13:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-variable-did-not-get-created-in-data-cleaning/m-p/189466#M265983</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-10-17T15:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: why variable did not get created in data cleaning?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-variable-did-not-get-created-in-data-cleaning/m-p/189467#M265984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG alt="code1.PNG" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/7647_code1.PNG" width="450" /&gt;Hey Reeza,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yep - do you have any suggestions for how I can paste code without using the HTML box option?&lt;/P&gt;&lt;P&gt;I ve attached an image of the portion of my code I have a question about.&amp;nbsp; the error I receive is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Variable NoServices is not on file WORK. PARTIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if I should elaborate or clarify&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 15:18:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-variable-did-not-get-created-in-data-cleaning/m-p/189467#M265984</guid>
      <dc:creator>Maisha_Huq</dc:creator>
      <dc:date>2014-10-17T15:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: why variable did not get created in data cleaning?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-variable-did-not-get-created-in-data-cleaning/m-p/189468#M265985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use a different browser, not IE, or copy paste to Word/Notepad and then to here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've never seen a %include inside a data step like that.&amp;nbsp; I'm not sure that's valid either, what are you expecting that piece of code to do? Perhaps move that to before your data step if you're expecting it to create a format or some data set that should exist?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 15:25:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-variable-did-not-get-created-in-data-cleaning/m-p/189468#M265985</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-10-17T15:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: why variable did not get created in data cleaning?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-variable-did-not-get-created-in-data-cleaning/m-p/189469#M265986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;ERROR: Variable NoServices is not on file WORK.PARTIC&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;So only these two lines are relevant to the error message.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp; set partic;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; where NoServices ne 1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If you think the the variable NOSERVICES should already be on the input dataset then look upstream for the error.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If instead you are intending the WHERE clause to change the records that are OUTPUT instead of the records that are INPUT then you probably want to change it from WHERE to IF.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 15:51:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-variable-did-not-get-created-in-data-cleaning/m-p/189469#M265986</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-10-17T15:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: why variable did not get created in data cleaning?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/why-variable-did-not-get-created-in-data-cleaning/m-p/189470#M265987</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The NOSERVICES var shouldn't be in the input dataset; I create it in the output/new dataset, partic_cln.&amp;nbsp; using 'IF&amp;nbsp; NoServices=1 then delete;&lt;/P&gt;&lt;P&gt;worked and I had a problem elsewhere too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Oct 2014 16:06:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/why-variable-did-not-get-created-in-data-cleaning/m-p/189470#M265987</guid>
      <dc:creator>Maisha_Huq</dc:creator>
      <dc:date>2014-10-17T16:06:48Z</dc:date>
    </item>
  </channel>
</rss>

