<?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: Developing proc informat set up in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Developing-proc-informat-set-up/m-p/814925#M321677</link>
    <description>&lt;P&gt;Don't understand what you are saying you currently have.&lt;/P&gt;
&lt;P&gt;Do you have text that looks like your first example? Including the equal sign?&amp;nbsp; Why would text like that be in an EXCEL spreadsheet?&amp;nbsp; Would it be more useful to have two columns in the EXCEL sheet.&amp;nbsp; One with the name and one with the code?&lt;/P&gt;
&lt;P&gt;Something like this dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data metadata;
  input code $ name $40.;
cards;
2003 Agricultural_worker
2004 Apparel_Manufacturing
2002 Beverage_Manufacturing
2005 Cabinets_Woodworking
3003 Construction_Homes_Residential
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which you could easily convert into a CNTLIN dataset to create an FORMAT (if you need CODE to be numeric define and INFORMAT instead) and then use PROC FORMAT to read in that dataset and define the FORMAT.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cntlin;
  fmtname='$CODE';
  set metadata;
  start = name;
  label = code ;
run;

proc format cntlin=cntlin;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which you could then use to encode your current names into code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  code = put(name,$code.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 24 May 2022 18:03:59 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-05-24T18:03:59Z</dc:date>
    <item>
      <title>Developing proc informat set up</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Developing-proc-informat-set-up/m-p/814923#M321675</link>
      <description>&lt;P&gt;This question is building off of a solution from ballardw(Super User) regarding building a proc informat approach to labeling employment titles.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have many, many lines of type_firm descriptions a sampling will look something like in Excel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Agricultural_worker&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2003&lt;/P&gt;
&lt;P&gt;Apparel_Manufacturing&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2004&lt;/P&gt;
&lt;P&gt;Beverage_Manufacturing&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2002&lt;/P&gt;
&lt;P&gt;Cabinets_Woodworking&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2005&lt;/P&gt;
&lt;P&gt;Construction_Homes_Residential&amp;nbsp;&amp;nbsp;&amp;nbsp; = 3002&lt;/P&gt;
&lt;P&gt;(the codes are what I am using to delineate the different firm types)&lt;/P&gt;
&lt;P&gt;and so on I guess I have two questions&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) can I just copy and paste these rows into my data step - actually the Proc format&lt;/P&gt;
&lt;P&gt;(and I have ~ 940 rows and Services will have well over 1500)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and 2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once step number 1 is successful the should look like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc format&lt;/P&gt;
&lt;P&gt;invalue Firm_type (upcase)&lt;/P&gt;
&lt;P&gt;Agricultural_worker&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2003&lt;/P&gt;
&lt;P&gt;Apparel_Manufacturing&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2004&lt;/P&gt;
&lt;P&gt;Beverage_Manufacturing&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2002&lt;/P&gt;
&lt;P&gt;Cabinets_Woodworking&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2005&lt;/P&gt;
&lt;P&gt;Construction_Homes_Residential&amp;nbsp;&amp;nbsp;&amp;nbsp; = 3002&amp;nbsp;&amp;nbsp; and so on&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how would I code so that " " can be added to the start and end of the type firm to look like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Agricultural_worker" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2003&lt;/P&gt;
&lt;P&gt;"Apparel_Manufacturing" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2004&lt;/P&gt;
&lt;P&gt;"Beverage_Manufacturing" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2002&lt;/P&gt;
&lt;P&gt;"Cabinets_Woodworking" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = 2005&lt;/P&gt;
&lt;P&gt;"Construction_Homes_Residential" &amp;nbsp;&amp;nbsp; = 3002&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another thing just occurred to me the codes on the excel spread sheet look like '= then the no&lt;/P&gt;
&lt;P&gt;so the ' before the = needs to be removed too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a long convoluted question, but I appreciate your help and assistance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;wlierman&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 17:52:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Developing-proc-informat-set-up/m-p/814923#M321675</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2022-05-24T17:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: Developing proc informat set up</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Developing-proc-informat-set-up/m-p/814924#M321676</link>
      <description>Do you know that you can create a format from a data set instead of trying to generate proc format code? Or do you want to generate the code for some reason?&lt;BR /&gt;&lt;BR /&gt;A quick way to figure out how to configure the data set is to make a small data set, pipe that out and then use CNTLIN to create the dataset.&lt;BR /&gt;&lt;BR /&gt;*assuming you have created your firm type format;&lt;BR /&gt;proc format cntlout=demo;&lt;BR /&gt;select FIRM_TYPE;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Create a data set that's similar using your imported data from Excel. &lt;BR /&gt;&lt;BR /&gt;Then create the format using:&lt;BR /&gt;&lt;BR /&gt;proc format cntlin=yourDataset;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;References:&lt;BR /&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings/proceedings/forum2007/068-2007.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings/proceedings/forum2007/068-2007.pdf&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n1e19y6lrektafn1kj6nbvhus59w.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n1e19y6lrektafn1kj6nbvhus59w.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 24 May 2022 18:00:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Developing-proc-informat-set-up/m-p/814924#M321676</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-05-24T18:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Developing proc informat set up</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Developing-proc-informat-set-up/m-p/814925#M321677</link>
      <description>&lt;P&gt;Don't understand what you are saying you currently have.&lt;/P&gt;
&lt;P&gt;Do you have text that looks like your first example? Including the equal sign?&amp;nbsp; Why would text like that be in an EXCEL spreadsheet?&amp;nbsp; Would it be more useful to have two columns in the EXCEL sheet.&amp;nbsp; One with the name and one with the code?&lt;/P&gt;
&lt;P&gt;Something like this dataset.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data metadata;
  input code $ name $40.;
cards;
2003 Agricultural_worker
2004 Apparel_Manufacturing
2002 Beverage_Manufacturing
2005 Cabinets_Woodworking
3003 Construction_Homes_Residential
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which you could easily convert into a CNTLIN dataset to create an FORMAT (if you need CODE to be numeric define and INFORMAT instead) and then use PROC FORMAT to read in that dataset and define the FORMAT.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cntlin;
  fmtname='$CODE';
  set metadata;
  start = name;
  label = code ;
run;

proc format cntlin=cntlin;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Which you could then use to encode your current names into code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  code = put(name,$code.);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 May 2022 18:03:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Developing-proc-informat-set-up/m-p/814925#M321677</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-24T18:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: Developing proc informat set up</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Developing-proc-informat-set-up/m-p/814942#M321683</link>
      <description>Thank you for the information I think between your answer and Tom's answer that these are solutions.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 24 May 2022 19:09:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Developing-proc-informat-set-up/m-p/814942#M321683</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2022-05-24T19:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Developing proc informat set up</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Developing-proc-informat-set-up/m-p/814943#M321684</link>
      <description>Thank you for the response.&amp;nbsp; Both you and Reeza are on the same track.&lt;BR /&gt;I will set up the code as you both have described.&lt;BR /&gt;Thank you.&lt;BR /&gt;wlierman&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 24 May 2022 19:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Developing-proc-informat-set-up/m-p/814943#M321684</guid>
      <dc:creator>wlierman</dc:creator>
      <dc:date>2022-05-24T19:11:09Z</dc:date>
    </item>
  </channel>
</rss>

