<?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: Using an external control file to create formats in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-an-external-control-file-to-create-formats/m-p/688727#M209292</link>
    <description>&lt;P&gt;Either approach will use proc format, one uses a data set as input using the Cntlin option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Cntlin data set requires specific variables to work. One of the easiest ways to determine what that data set look like is to create a couple of small formats using value statements and then use the option on the Proc Format statement to create an output data set with the Cntlout=&amp;lt;data set name&amp;gt;. Or use the example value statements for the entire example and use the Cntlout option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The key elements that you must provide are a 1) the format name 2) the Start value (original value) 3) the label (the formatted value for the start value and 4) the type, numeric or character. If you have a range of values then you need an End value to indicate the upper value. If you are using ranges with excluded endpoints I recommend creating a small example and examining a cntlout data set as you need to set a couple more variables.&lt;/P&gt;</description>
    <pubDate>Sun, 04 Oct 2020 01:45:21 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-10-04T01:45:21Z</dc:date>
    <item>
      <title>Using an external control file to create formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-an-external-control-file-to-create-formats/m-p/688721#M209287</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;I am currently stuck on a homework question about creating formats using an external control file. I am working in SAS Studio for SAS OnDemand. The SAS version is 9.4_M6 and operating on the Linux X64 environment.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the question and I have also attached the file mentioned in the question:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I realize that I could use the 'proc format' statement instead, but I would like to learn how to accomplish it using the external control file method.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I am missing some information regarding how to set up an external control file and how to develop the syntax to use it to create formats.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If anyone can help me, please let me know. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sincerely,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kaitlin E Buck&lt;/P&gt;</description>
      <pubDate>Thu, 10 Dec 2020 15:16:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-an-external-control-file-to-create-formats/m-p/688721#M209287</guid>
      <dc:creator>kateb409</dc:creator>
      <dc:date>2020-12-10T15:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using an external control file to create formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-an-external-control-file-to-create-formats/m-p/688725#M209290</link>
      <description>&lt;P&gt;This homework is offering you the choice to use&amp;nbsp; the CNTLIN= option in proc format.&amp;nbsp; Starting from the&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=n1c16dxnndwfzyn14o1kb8a4312m.htm&amp;amp;locale=en" target="_self"&gt;Summary of Optional Arguments&lt;/A&gt;&amp;nbsp;documentation page for proc format, click on the&amp;nbsp;&lt;A tabindex="0" href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=n1c16dxnndwfzyn14o1kb8a4312m.htm&amp;amp;locale=en#n1l9h98t2b6lomn1ur1653iklmi9" target="_self" data-docset-id="proc" data-docset-version="9.4" data-original-href="#n1l9h98t2b6lomn1ur1653iklmi9"&gt;CNTLIN=&lt;EM class="xisDoc-userSuppliedValue"&gt;input-control-SAS-data-set&lt;/EM&gt;&lt;/A&gt;&amp;nbsp;link.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Drill down further (to&amp;nbsp;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=p0owa4ftikc2ekn1q0rmpulg86cx.htm&amp;amp;locale=en#p05g1cdvff8h8tn1frtzxrnkzezo" target="_self"&gt;Input Control Data Set)&lt;/A&gt;.&amp;nbsp; You can write a SAS dta step to read in the &lt;EM&gt;&lt;STRONG&gt;Study Formats&lt;/STRONG&gt;&lt;/EM&gt; sheet in your workbook to create a sas dataset with variables such as FMTNAME,&amp;nbsp; START, END, LABEL, MIN, MAX, LENGTH HLO, and others described in the documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The last link above includes the following text (&lt;EM&gt;&lt;STRONG&gt;bold italics&lt;/STRONG&gt;&lt;/EM&gt; mine).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;You specify an input control data set with the CNTLIN= option in the PROC FORMAT statement. The FORMAT procedure uses the data in the input control data set to construct informats and formats. Thus, you can create informats and formats &lt;EM&gt;&lt;STRONG&gt;without writing INVALUE, PICTURE, or VALUE statements&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Oct 2020 00:29:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-an-external-control-file-to-create-formats/m-p/688725#M209290</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2020-10-04T00:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using an external control file to create formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-an-external-control-file-to-create-formats/m-p/688727#M209292</link>
      <description>&lt;P&gt;Either approach will use proc format, one uses a data set as input using the Cntlin option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Cntlin data set requires specific variables to work. One of the easiest ways to determine what that data set look like is to create a couple of small formats using value statements and then use the option on the Proc Format statement to create an output data set with the Cntlout=&amp;lt;data set name&amp;gt;. Or use the example value statements for the entire example and use the Cntlout option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The key elements that you must provide are a 1) the format name 2) the Start value (original value) 3) the label (the formatted value for the start value and 4) the type, numeric or character. If you have a range of values then you need an End value to indicate the upper value. If you are using ranges with excluded endpoints I recommend creating a small example and examining a cntlout data set as you need to set a couple more variables.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Oct 2020 01:45:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-an-external-control-file-to-create-formats/m-p/688727#M209292</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-10-04T01:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using an external control file to create formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-an-external-control-file-to-create-formats/m-p/688813#M209345</link>
      <description>&lt;P&gt;You create a file with the old values, new values/ranges and the format names.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you import the file into SAS and add some details to the dataset needed for SAS to understand.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This means that variables need specific names (format name, format type, start, end, label, hlo) are the typical ones you'll want to pay attention to.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The documentation has a good example here that's pretty detailed and your formats are pretty straightforward, the hlo usage is the most complicated thing you'll need to account for in your code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=n1e19y6lrektafn1kj6nbvhus59w.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=proc&amp;amp;docsetTarget=n1e19y6lrektafn1kj6nbvhus59w.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FYI - you can use CNTLOUT to get your formats back out of a proc if you never need it as well. I sometimes use this trick to see how I need to structure my CNTLIN data sets so I create the format using PROC FORMAT, pipe it back out to a data set and see how it's formatted and which variables I need to specify and how.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value age_group
low - 13 = 'Pre-Teen'
13 - 16 = 'Teen'
16 - high = 'Adult';

value $ gender_fmt
'M' = 'Male'
'F' = 'Female'
other = 'Other';
run;

proc format cntlout=check_format_table;
run;

proc print data=check_format_Table;
var fmtname type start end label hlo sexcl eexcl;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/348641"&gt;@kateb409&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;I am currently stuck on a homework question about creating formats using an external control file. I am working in SAS Studio for SAS OnDemand. The SAS version is 9.4_M6 and operating on the Linux X64 environment.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the question and I have also attached the file mentioned in the question:&lt;/P&gt;
&lt;P&gt;"Task:&amp;nbsp; The ‘Data Map - Hypertension Study.xlsx’ file contains a worksheet named ‘Study Formats’.&amp;nbsp; Use the specifications found there to create the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the ‘HypTabs’ library, a catalog named ‘HypFormats’ which contains the 11 formats (7 numeric and 4 character) per the Data Map specifications.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may accomplish this using either:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;A PROC FORMAT statement with 11 VALUE statements, or&lt;/LI&gt;
&lt;LI&gt;Build a control file with the required variables&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In Box ‘A’ below, copy-and-paste the output from PROC CATALOG to show that all 11 formats were created and are stored in the ‘HypTabs.HypFormats’ catalog.&lt;/P&gt;
&lt;P&gt;Box ‘B’ (below) is to contain the details used to create each format.&amp;nbsp; Copy-and-paste either:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The PROC FORMAT SAS code used to create the 11 formats (i.e. containing all 11 VALUE statement if they were used to create the formats), or&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;The contents of the control file (e.g. Excel worksheet) used to generated the 11 formats using the CNTLIN= option."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I realize that I could use the 'proc format' statement instead, but I would like to learn how to accomplish it using the external control file method.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I am missing some information regarding how to set up an external control file and how to develop the syntax to use it to create formats.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If anyone can help me, please let me know. Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sincerely,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kaitlin E Buck&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 01:41:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-an-external-control-file-to-create-formats/m-p/688813#M209345</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-10-05T01:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using an external control file to create formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-an-external-control-file-to-create-formats/m-p/689641#M209668</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, thank you for this explanation. I like how you actually gave me an example to visualize it. I think I did not understand the very basic fundamentals of it, so I had my professor explain it a little more in class yesterday, so now I'll have to play around with it myself to what works and what doesn't.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sincerely,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kaitlin E Buck&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2020 17:34:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-an-external-control-file-to-create-formats/m-p/689641#M209668</guid>
      <dc:creator>kateb409</dc:creator>
      <dc:date>2020-10-07T17:34:35Z</dc:date>
    </item>
  </channel>
</rss>

