<?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: How to get TYPE, LENGTH, LABEL, FORMAT, INFORMAT, and INPUT using SAS Enterprise in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881537#M348324</link>
    <description>&lt;P&gt;Thanks so much, Kurt.&lt;/P&gt;&lt;P&gt;I will try that. My initial attempts have not worked well but I will keep trying. One other plan is to rename the variables to shorten the lengths because some are being truncated.&lt;/P&gt;&lt;P&gt;I appreciate your time and guidance.&lt;/P&gt;</description>
    <pubDate>Tue, 20 Jun 2023 13:01:17 GMT</pubDate>
    <dc:creator>Jallah_Kennedy</dc:creator>
    <dc:date>2023-06-20T13:01:17Z</dc:date>
    <item>
      <title>How to get TYPE, LENGTH, LABEL, FORMAT, INFORMAT, and INPUT using SAS Enterprise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881025#M348135</link>
      <description>&lt;P&gt;Please help me with the syntax or process to use with SAS Enterprise to automatically obtain the following from large csv or Excel dataset:&lt;/P&gt;&lt;P&gt;TYPE&lt;/P&gt;&lt;P&gt;LENGTH&lt;/P&gt;&lt;P&gt;LABEL&lt;/P&gt;&lt;P&gt;FORMAT&lt;/P&gt;&lt;P&gt;INFORMAT&lt;/P&gt;&lt;P&gt;INPUT&lt;/P&gt;&lt;P&gt;A former colleague used SAS Enterprise to often provide these for large csv and Excel datasets to avoid us spending so much time counting and typing (e.g. length and label….) for many variables.&lt;/P&gt;&lt;P&gt;If there is a syntax that can also be used with Base SAS 9.4, that will be even more helpful.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 22:44:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881025#M348135</guid>
      <dc:creator>Jallah_Kennedy</dc:creator>
      <dc:date>2023-06-15T22:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to get TYPE, LENGTH, LABEL, FORMAT, INFORMAT, and INPUT using SAS Enterprise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881026#M348136</link>
      <description>&lt;P&gt;Can you explain your question a bit more?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Type, Length, Label, etc are attributes of a SAS dataset.&amp;nbsp; You can't get them from a CSV or Excel file, without reading the data into a SAS dataset first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is your question "how can I read data from a CSV file or Excel file without typing in a list of variables and informats?"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is that question, you can take a look at PROC IMPORT, which will try to guess column types, and the XLSX engine.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 22:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881026#M348136</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-06-15T22:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get TYPE, LENGTH, LABEL, FORMAT, INFORMAT, and INPUT using SAS Enterprise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881029#M348137</link>
      <description>&lt;P&gt;Unless there were the creator of the file and so knew what went into it the only way to DERIVE those from the file is to look at the file and make guesses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC IMPORT will do this.&amp;nbsp; For delimited text file, like a CSV file, you might also want to look at the&amp;nbsp;&lt;A href="https://github.com/sasutils/macros/blob/master/csv2ds.sas" target="_self"&gt;%CSV2DS()&lt;/A&gt;&amp;nbsp;macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a SAS dataset you can get the NAME, TYPE, LENGTH of a variable using PROC CONTENTS.&amp;nbsp; &amp;nbsp;That will also provide FORMAT, INFORMAT and LABEL (if any is attached).&amp;nbsp; It will also produce VARNUM to let you know the order in the SAS dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=have out=want noprint; run;
proc print data=want;
  var varnum name type length format informat label ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Jun 2023 23:28:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881029#M348137</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-15T23:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to get TYPE, LENGTH, LABEL, FORMAT, INFORMAT, and INPUT using SAS Enterprise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881030#M348138</link>
      <description>&lt;P&gt;Thanks so much, Quentin for&amp;nbsp;the prompt response.&lt;/P&gt;&lt;P&gt;No, that's not what I am looking for.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think there is a function or some way to have SAS Enterprise to provide an entire output of the&amp;nbsp;LENGTH, LABEL, FORMAT, INFORMAT, and INPUT. You can then use that to import to read the entire csv or xlsx file correctly.&lt;/P&gt;&lt;P&gt;This is because, sometimes when the variables are many variables and their names are longer, this process reduces the time and avoids some truncating while remaining within the SAS limits for the name of a variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 23:28:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881030#M348138</guid>
      <dc:creator>Jallah_Kennedy</dc:creator>
      <dc:date>2023-06-15T23:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get TYPE, LENGTH, LABEL, FORMAT, INFORMAT, and INPUT using SAS Enterprise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881042#M348143</link>
      <description>&lt;P&gt;You read the documentation of the csv file and write the code accordingly. Documentation of a data file has to contain all the information you need (type, length, format) to write the DATA step that reads the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without documentation, either the SAS system (PROC IMPORT) or you have to make guesses, where usually your guesses will be better.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With consistent and proper documentation, you might be able to write code which creates the import code with reliable and consistent results; but you have to decide if the effort of writing such code (which will be substantial) is worth it.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 05:11:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881042#M348143</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-16T05:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to get TYPE, LENGTH, LABEL, FORMAT, INFORMAT, and INPUT using SAS Enterprise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881537#M348324</link>
      <description>&lt;P&gt;Thanks so much, Kurt.&lt;/P&gt;&lt;P&gt;I will try that. My initial attempts have not worked well but I will keep trying. One other plan is to rename the variables to shorten the lengths because some are being truncated.&lt;/P&gt;&lt;P&gt;I appreciate your time and guidance.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 13:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881537#M348324</guid>
      <dc:creator>Jallah_Kennedy</dc:creator>
      <dc:date>2023-06-20T13:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to get TYPE, LENGTH, LABEL, FORMAT, INFORMAT, and INPUT using SAS Enterprise</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881613#M348340</link>
      <description>&lt;P&gt;Thanks so much, Tom.&lt;/P&gt;&lt;P&gt;I ran proc contents but did not add some of what you suggested. I will try them as well. Much appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 20:42:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-TYPE-LENGTH-LABEL-FORMAT-INFORMAT-and-INPUT-using-SAS/m-p/881613#M348340</guid>
      <dc:creator>Jallah_Kennedy</dc:creator>
      <dc:date>2023-06-20T20:42:50Z</dc:date>
    </item>
  </channel>
</rss>

