<?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: Formating with PUT in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Formating-with-PUT/m-p/623578#M19954</link>
    <description>&lt;P&gt;However, the use of dashes in the name of the format&amp;nbsp; ($AUDD2019-LIL5-K) is not permitted in SAS.&amp;nbsp;&amp;nbsp; So I would be very interested to know how this was successfully used in a sas program.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Feb 2020 15:11:10 GMT</pubDate>
    <dc:creator>mkeintz</dc:creator>
    <dc:date>2020-02-10T15:11:10Z</dc:date>
    <item>
      <title>Formating with PUT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Formating-with-PUT/m-p/623564#M19947</link>
      <description>&lt;P&gt;Dear all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS but advanced in STATA. I have a variable called hfaudd (highest accomplished education) which I would like to formate to a better (esier to interpret) variable with Primary school, Upper secondary school, higher education and Post graduate. The variabel is confusing build up, where it goes from 1-9914 with each education being a differnt number.&lt;/P&gt;&lt;P&gt;I got a piece of code from a collegue:&amp;nbsp;&lt;SPAN&gt;Newvar = put(hfaudd, $AUDD2010-LIL5-K.), which for me look like SAS. Can anyone tell me what "$AUDD2010-LIL5-K" is supossed to do? or maybe the hole thing in a contekts?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I know AUDD is a register, but do not know about LIL.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then if i am lucky I could start seeing a pattern in the variable and might even be able to solve the problem in STATA.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best Mads Ø &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 14:23:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Formating-with-PUT/m-p/623564#M19947</guid>
      <dc:creator>Oernfeldt</dc:creator>
      <dc:date>2020-02-10T14:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Formating with PUT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Formating-with-PUT/m-p/623567#M19948</link>
      <description>&lt;P&gt;Looks like it's a custom format for your specific use case. So someone most likely created it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have this data for my business&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Column&lt;/P&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;P&gt;2&lt;/P&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;P&gt;1&lt;/P&gt;
&lt;P&gt;3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That doesn't mean much. I am creating a custom format to make this more meaningful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My custom format is named businesstype, and will format those numbers to the following:&lt;/P&gt;
&lt;P&gt;1 = Local&lt;/P&gt;
&lt;P&gt;2 = Global&lt;/P&gt;
&lt;P&gt;3 = Unknown&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I can apply that custom format I created into a new column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I would use:&lt;/P&gt;
&lt;P&gt;newColumn = put(column, $businesstype.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;New table will look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Column&amp;nbsp; &amp;nbsp;NewColumn&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Local&lt;/P&gt;
&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Global&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Local&lt;/P&gt;
&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Local&lt;/P&gt;
&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Unknown&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The $ sign in front of the format indicates it's character. The put function r&lt;SPAN&gt;eturns a value using a specified format.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0mlfb88dkhbmun1x08qbh5xbs7e.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;&lt;SPAN&gt;PUT Function&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/?docsetId=proc&amp;amp;docsetTarget=n0ffrdxmvjtxf7n18vowl8mvl52x.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;&lt;SPAN&gt;Format PROC&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run this program. It'll create a format and a table, then apply that format to create a new column. At the end it has code how to see what your format does. Looks like your original column is probably character since the format uses a $ sign.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will have to adjust the format proc to find where you format is if you want to see what it does.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*create custom format*/
proc format;
	value $businesstype 
		'1' = 'Local'
		'2' = 'Global'
		'3' = 'Unknown';
run;

/*create fake table*/
data test;
	infile datalines;
	input Column :$4.;
	datalines;
1
2
1
1
3
;
run;

/*apply format*/
data newtable;
	set test;
	NewColumn=put(column,$businesstype.);
run;


/*view what the format does*/
proc format fmtlib lib=work; /*lib= points to the library the format is in. Mine is in work, not sure where yours is.*/
	select $businesstype; /*select the format to view*/
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Peter&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 14:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Formating-with-PUT/m-p/623567#M19948</guid>
      <dc:creator>Panagiotis</dc:creator>
      <dc:date>2020-02-10T14:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: Formating with PUT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Formating-with-PUT/m-p/623569#M19950</link>
      <description>&lt;P&gt;Thank you very must for the quick answer! I will look in to it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Mads&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 14:44:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Formating-with-PUT/m-p/623569#M19950</guid>
      <dc:creator>Oernfeldt</dc:creator>
      <dc:date>2020-02-10T14:44:47Z</dc:date>
    </item>
    <item>
      <title>Re: Formating with PUT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Formating-with-PUT/m-p/623570#M19951</link>
      <description>&lt;P&gt;No problem!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Peter&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 14:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Formating-with-PUT/m-p/623570#M19951</guid>
      <dc:creator>Panagiotis</dc:creator>
      <dc:date>2020-02-10T14:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: Formating with PUT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Formating-with-PUT/m-p/623578#M19954</link>
      <description>&lt;P&gt;However, the use of dashes in the name of the format&amp;nbsp; ($AUDD2019-LIL5-K) is not permitted in SAS.&amp;nbsp;&amp;nbsp; So I would be very interested to know how this was successfully used in a sas program.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 15:11:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Formating-with-PUT/m-p/623578#M19954</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-02-10T15:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Formating with PUT</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Formating-with-PUT/m-p/623579#M19955</link>
      <description>&lt;P&gt;I noticed that as well. I figured maybe the creator knows of a workaround that I am not familiar with? I'd love to know how they did too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- Peter&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2020 15:16:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Formating-with-PUT/m-p/623579#M19955</guid>
      <dc:creator>Panagiotis</dc:creator>
      <dc:date>2020-02-10T15:16:18Z</dc:date>
    </item>
  </channel>
</rss>

