<?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: User defined formats in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-formats/m-p/435794#M68985</link>
    <description>&lt;P&gt;How consistent are these phrases? Are there a small number of them associated with this field and do they stay the same (assuming you will read more than one file with the same field)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example where I have to deal with inconsistent text to create and do something similar to what you are doing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
Invalue AllRetention
.,'',' ' = 1
"Changing Schedule" = 4
"Child no longer in family custody" = 3
"Child no longer in family, custody (parental rights terminated)" =3
"Child no longer with caregiver" =3
"Child no longer with family/caregiver"=3
"Child reached 2nd birthday" = 2
"Client incarcerated" = 3
"Caregiver incarcerated" = 3 
"Client received what she needs from the program"= 2
"Family participation goals met" = 2 

"Client returned to work or school" = 4
"Completed program service cycle" = 2
"Dissatisfied with program" =3
"Drop-out"  =3
"Excessive missed appointments/attempted visits" =3
"Family no longer interested in program" = 3  
"Index child reached maximum age"=2
"Maternal death"                 =3
"Miscarried/fetal death/infant death","Miscarried/fetal death" =4
"Missed home visits (excessive)"= 3
"Move" =3
"Moved out of service area" = 3
"Other"                 =4
"Other or Unknown" = 4
"Pressure from family" =3
"Program Completed" =2
"Program unable to provide service to client"    =4    
"Refused new nurse" = 3
"Returned to work or school" =4
"Refused participation" = 3
"Transition to another program" = 4
"Unable to contact" = 3
"Unable to contact or locate" =3
"Unable to locate"  =3
Other=_error_
;
Value Retention
., 1 = 'Currently receiving services'  
2 = 'Completed program'
3 = 'Stopped services before completion'
4 = 'Other'
;
run;
&lt;/PRE&gt;
&lt;P&gt;Note that on the INVALUE part is have the Other=_error_&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That means that when I use this informat&amp;nbsp;and encounter a value I wasn't expecting I get an error message. The log will tell me that there is invalid data and I can the text and assign an appropriate value. Then rerun the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The values must be &lt;STRONG&gt;exactly&lt;/STRONG&gt; as used in the INVALUE definition. The Upcase option may help if you get values like 'Female' 'female' 'FEMALE' in your data to compare all the values to the upcase version.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Feb 2018 18:48:43 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-02-09T18:48:43Z</dc:date>
    <item>
      <title>User defined formats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-formats/m-p/435743#M68981</link>
      <description>The observation having the value as "I don't have any sadness" and I want to format this observation as numeric zero (0). For this observation I have to create user defined formats. Please help on this issue</description>
      <pubDate>Fri, 09 Feb 2018 17:53:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-formats/m-p/435743#M68981</guid>
      <dc:creator>Chiluka</dc:creator>
      <dc:date>2018-02-09T17:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: User defined formats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-formats/m-p/435774#M68983</link>
      <description>&lt;P&gt;Here's a good write up on PROC FORMAT and creating format. It looks like you're creating an informat, where you're trying to convert a character variable to a numeric variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/sugi30/001-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/001-30.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 18:22:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-formats/m-p/435774#M68983</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-09T18:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: User defined formats</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/User-defined-formats/m-p/435794#M68985</link>
      <description>&lt;P&gt;How consistent are these phrases? Are there a small number of them associated with this field and do they stay the same (assuming you will read more than one file with the same field)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example where I have to deal with inconsistent text to create and do something similar to what you are doing:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
Invalue AllRetention
.,'',' ' = 1
"Changing Schedule" = 4
"Child no longer in family custody" = 3
"Child no longer in family, custody (parental rights terminated)" =3
"Child no longer with caregiver" =3
"Child no longer with family/caregiver"=3
"Child reached 2nd birthday" = 2
"Client incarcerated" = 3
"Caregiver incarcerated" = 3 
"Client received what she needs from the program"= 2
"Family participation goals met" = 2 

"Client returned to work or school" = 4
"Completed program service cycle" = 2
"Dissatisfied with program" =3
"Drop-out"  =3
"Excessive missed appointments/attempted visits" =3
"Family no longer interested in program" = 3  
"Index child reached maximum age"=2
"Maternal death"                 =3
"Miscarried/fetal death/infant death","Miscarried/fetal death" =4
"Missed home visits (excessive)"= 3
"Move" =3
"Moved out of service area" = 3
"Other"                 =4
"Other or Unknown" = 4
"Pressure from family" =3
"Program Completed" =2
"Program unable to provide service to client"    =4    
"Refused new nurse" = 3
"Returned to work or school" =4
"Refused participation" = 3
"Transition to another program" = 4
"Unable to contact" = 3
"Unable to contact or locate" =3
"Unable to locate"  =3
Other=_error_
;
Value Retention
., 1 = 'Currently receiving services'  
2 = 'Completed program'
3 = 'Stopped services before completion'
4 = 'Other'
;
run;
&lt;/PRE&gt;
&lt;P&gt;Note that on the INVALUE part is have the Other=_error_&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That means that when I use this informat&amp;nbsp;and encounter a value I wasn't expecting I get an error message. The log will tell me that there is invalid data and I can the text and assign an appropriate value. Then rerun the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The values must be &lt;STRONG&gt;exactly&lt;/STRONG&gt; as used in the INVALUE definition. The Upcase option may help if you get values like 'Female' 'female' 'FEMALE' in your data to compare all the values to the upcase version.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 18:48:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/User-defined-formats/m-p/435794#M68985</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-09T18:48:43Z</dc:date>
    </item>
  </channel>
</rss>

