<?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: Why Does Vinformat not return informat if informat was set by input? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939877#M368986</link>
    <description>Yes I am aware of that. Informats are then expressed as the tool to have an item or collection of data in a more restricted form than the two types allow, that is why I am saying SAS uses informats as other languages would use types.</description>
    <pubDate>Mon, 19 Aug 2024 13:30:17 GMT</pubDate>
    <dc:creator>daid13</dc:creator>
    <dc:date>2024-08-19T13:30:17Z</dc:date>
    <item>
      <title>Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939390#M368837</link>
      <description>&lt;P&gt;Hi, I'm new round here, started using SAS two months ago for a new job.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The context is I'm working on a macro with similar functionality to minlevel from this paper but recognising there are at least 3 valid ways/(informally)formats SAS has of storing iso8601 dates. I have all the human readable formats within iso spec covered reasonably well but I need to convert the SAS internal storage to that to make the calculations. So the plan is to use vinformat to check if the informat is $N8601E. if so use put to convert it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is vinformat does not seem to recognise if the informat was defined in the input statement and I don't know why, can someone explain? As you can see in the code and image below, vinformat returns the informat name if the informat step was used but returns just $ if the same informat was used in the input statement.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%macro trial(in, out);
    &amp;amp;out.=vinformatn(&amp;amp;in.);

%mend trial;


data inputset3;
    INFORMAT dt $N8601E20.;
    INPUT dt ;
    %trial(dt, informat);
    DATALINES;
1999
1999-12
1999-12-25
1999-12-25T12
1999-12-25T12:13
1999-12-25T12:13:30
;

data expectedset3;
    INPUT dt :$N8601E20.;
    
    %trial(dt, informat);
    DATALINES;
1999
1999-12
1999-12-25
1999-12-25T12
1999-12-25T12:13
1999-12-25T12:13:30
;


PROC print data=inputset3;
    TITLE informat;
RUN;

PROC PRINT data=expectedset3;
    TITLE input;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="daid13_0-1723720000081.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99298i3A8B936E52F3C9E7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="daid13_0-1723720000081.png" alt="daid13_0-1723720000081.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 11:08:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939390#M368837</guid>
      <dc:creator>daid13</dc:creator>
      <dc:date>2024-08-15T11:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939395#M368840</link>
      <description>&lt;P&gt;VINFORMAT returns the name of the INFORMAT permanently assigned to a variable in the variable's metadata. The code that creates &lt;STRONG&gt;inputset3&lt;/STRONG&gt; contains an INFORMAT statement that modifies the variable's metadata, the code that creates&amp;nbsp;&lt;STRONG&gt;expectedset3&lt;/STRONG&gt; does not. If you run this code after yours:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods select variables;
proc contents data=inputset3;
run;

ods select variables;
proc contents data=expectedset3;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The results show why you are getting the results:&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV class="l proctitle"&gt;&lt;STRONG&gt;inputset3&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" summary="Procedure Contents: Variables" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt; &lt;COLGROUP&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c b header" colspan="5" scope="colgroup"&gt;Alphabetic List of Variables and Attributes&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r b header" scope="col"&gt;#&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Variable&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Type&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Len&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Informat&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data"&gt;dt&lt;/TD&gt;
&lt;TD class="l data"&gt;Char&lt;/TD&gt;
&lt;TD class="r data"&gt;20&lt;/TD&gt;
&lt;TD class="l data"&gt;&lt;FONT color="#0000FF"&gt;$N8601E20.&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data"&gt;informat&lt;/TD&gt;
&lt;TD class="l data"&gt;Char&lt;/TD&gt;
&lt;TD class="r data"&gt;200&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="branch"&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG style="font-family: inherit;"&gt;expectedset3&lt;/STRONG&gt;&lt;/P&gt;
&lt;/DIV&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" summary="Procedure Contents: Variables" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt; &lt;COLGROUP&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c b header" colspan="4" scope="colgroup"&gt;Alphabetic List of Variables and Attributes&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r b header" scope="col"&gt;#&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Variable&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Type&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Len&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data"&gt;dt&lt;/TD&gt;
&lt;TD class="l data"&gt;Char&lt;/TD&gt;
&lt;TD class="r data"&gt;20&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data"&gt;informat&lt;/TD&gt;
&lt;TD class="l data"&gt;Char&lt;/TD&gt;
&lt;TD class="r data"&gt;200&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 15 Aug 2024 11:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939395#M368840</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2024-08-15T11:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939415#M368848</link>
      <description>&lt;P&gt;Since you're new to SAS, can you say more about the big picture of what you're trying to do?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Typically, SAS stores both dates, and date-times, in numeric variables.&amp;nbsp; A date is number of days since Jan 1, 1960.&amp;nbsp; A date-time is number of seconds since Jan 1, 1960.&amp;nbsp; So when you talk about doing calculations with dates, you would want a numeric variable.&amp;nbsp; To represent the date Jan 4, 1960, the value of the variable would be 3.&amp;nbsp; But you could use a format to display it as a human-readable string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your code, you've used an informat to read the data, but it's a character informat, which reads the value into a character variable.&amp;nbsp; The below log snippet shows the character (string) values in the variable DT:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;92   data inputset3;
93       INFORMAT dt $N8601E20.;
94       INPUT dt ;
95       put dt= ;
96       DATALINES;

dt=1999FFFFFFFFFFFD
dt=1999CFFFFFFFFFFD
dt=1999C25FFFFFFFFD
dt=1999C2512FFFFFFD
dt=1999C251213FFFFD
dt=1999C25121330FFD
NOTE: The data set WORK.INPUTSET3 has 6 observations and 1 variables.

103  ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That DT variable created is just a character variable.&amp;nbsp; You won't be able to do date calculations with it.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Typically when reading in data from a text file, would know the format of the data you are reading in, and then read it with a numeric informat which creates a numeric date or date-time variable.&lt;BR /&gt;&lt;BR /&gt;For this data, I might read it in with the B8601DT informat, which will create a numeric date-time variable.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data inputset3;
    INFORMAT dt B8601DT.;
    INPUT dt ;
    put "Date value is: " dt "The value can be displayed as " dt datetime19.;
    DATALINES;
1999
1999-12
1999-12-25
1999-12-25T12
1999-12-25T12:13
1999-12-25T12:13:30
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The PUT statement there will show the actual numeric value stored in the variable, and display value when it is formatted using the DATETIME format.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Log is:&lt;/P&gt;
&lt;PRE&gt;227  data inputset3;
228      INFORMAT dt B8601DT.;
229      INPUT dt ;
230      put "Date value is: " dt "The value can be displayed as " dt datetime19.;
231      DATALINES;

Date value is: 1230768000 The value can be displayed as  01JAN1999:00:00:00
Date value is: 1259625600 The value can be displayed as  01DEC1999:00:00:00
Date value is: 1261699200 The value can be displayed as  25DEC1999:00:00:00
Date value is: 1261742400 The value can be displayed as  25DEC1999:12:00:00
Date value is: 1261743180 The value can be displayed as  25DEC1999:12:13:00
Date value is: 1261743210 The value can be displayed as  25DEC1999:12:13:30
NOTE: The data set WORK.INPUTSET3 has 6 observations and 1 variables.

238  ;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2024 12:51:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939415#M368848</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-08-15T12:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939635#M368913</link>
      <description>&lt;P&gt;So I'm working on writing a proper suite of automated tests for a library of statistical analysis macros used for analysis of medical trials. And updating the existing macros to follow better practices, such as handling invalid input and managing edge cases.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I'm working with medical data, this needs to follow SDTM which mandates extended ISO8601 date format, with a few additional limitations as specified by SDTMIG. This means SAS numeric dates are not part of the work, other than one of my macros that I will be testing shortly that converts from numeric to ISO8601 format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The existing macro allowed for truncation but not omitted sections replaced by -, both of which are allowed by ISO8601. In addition to those human readable variants SAS like to store ISO8601 informatted data in an encoded fashion using a mix of decimal and hex. Definitely both the human readable options are valid input, they both follow the specification. As SAS claims that its encoded format is extended ISO8601, I believe I should consider this to be valid input because SAS considers it to match that style and it maps 1 to 1 with valid extended ISO8601 format. In addition, there is a fairly chaotic system for converting data in SDTM that is out of my control so it is plausible that data could reach this macro in that encoded format, given it is how SAS claims ISO8601 should be handled, for very odd reasons.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For this macro at least, it is definitely easier to find the correct output in the human readable form, so I want to be able to check if it is in the encoded format so I can convert it before applying the macros logic. Currently planning on moving valid ISO8601 date verification to a new macro but that will also need to handle the encoded informat, possibly I can do that with a clean regex.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 14:12:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939635#M368913</guid>
      <dc:creator>daid13</dc:creator>
      <dc:date>2024-08-16T14:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939639#M368916</link>
      <description>&lt;P&gt;Thanks SASJedi, that makes sense though it does leave me wondering why SAS is so inconsistent with its metadata and doesn't seem to be in the docs, at least not at the level I've looked at.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Going to have to move this to else where in my functionality or possibly do a regex straight on the SAS ISO8601 encoding though that, while simple appearing, doesn't seem to have clear documentation so I'll have to do it by eye.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 14:19:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939639#M368916</guid>
      <dc:creator>daid13</dc:creator>
      <dc:date>2024-08-16T14:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939643#M368919</link>
      <description>&lt;P&gt;The behavior of INPUT with regards to informats is documented here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsref/p0f9yk6pd4znukn1rlw6hzkg1url.htm#n0g45pgbwu9dc5n1d507pf0ru0zp" target="_blank" rel="noopener"&gt;INPUT Statement: Formatted&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 14:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939643#M368919</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-16T14:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939694#M368937</link>
      <description>&lt;P&gt;Are you asking to do validation of an SDTM dataset?&amp;nbsp; Aren't there already tools available to do that?&amp;nbsp; For example see this article:&amp;nbsp; &lt;A href="https://support.sas.com/resources/papers/proceedings17/0836-2017.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings17/0836-2017.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Why not just run those?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 19:43:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939694#M368937</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-16T19:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939695#M368938</link>
      <description>&lt;P&gt;In both of your examples there is nothing stored in the actual value of DT that indicates the value was created by using the $N8601E informat.&amp;nbsp; So if there is no informat specification attached to the variable there is nothing for VINFORMAT() function to return.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FORMAT in SAS has a specific meaning that is different than the way you are using the word.&amp;nbsp; In SAS a format is a tool for converting values into text.&amp;nbsp; So it is used when printing the value of variables.&amp;nbsp; It has nothing to do with how the values in the variable are stored or how they are created (other than that the format only works properly with the values it knows how to display.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can ATTACH a FORMAT to a variable so that SAS will use it by default.&amp;nbsp; Or you can request to use a format for a particular PROC step.&amp;nbsp; Or use a format with the PUT (or PUTN or PUTC) function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The same thing applies with INFORMATs, which are instructions for how to convert text into values.&amp;nbsp; If you want to ATTACH an informat to a variable you use the INFORMAT statement (or INFORMAT= option of ATTRIB statement or PROC SQL select statement.).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Aug 2024 19:53:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939695#M368938</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-16T19:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939862#M368981</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/468141"&gt;@daid13&lt;/a&gt;&amp;nbsp;- there is no inconsistency here. The DATA step produces the exact output it was directed to produce. Your program code for the dataset&amp;nbsp;&lt;STRONG&gt;inputset3&lt;/STRONG&gt; included a directive (INFORMAT statement) that assigned a default informat to the variable&amp;nbsp;&lt;STRONG&gt;dt&lt;/STRONG&gt;&amp;nbsp;in the variable's metadata, much as a LABEL and FORMAT statements modify the metadata with label text and a default format. It is reasonable for code to use a specific informat to read the current input, and to use an INFORMAT statement to assign a different default informat in the metadata for future use. Without an INFORMAT (or FORMAT or LABLE) statement, no modification is made to the metadata, as in your DATA step code that produced dataset &lt;STRONG&gt;expectedset3&lt;/STRONG&gt;. It's just that simple.&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;Consider the following code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	infile datalines truncover;
	input @1 V1 
		  @1 V2 binary3.
		  @5 V3 $3.
		  @5 V4 $UPCASE3.
	;
	informat V2 32. V3 V4 $UPCASE.;
	format   V1 V2 z3. V4 $REVERS3.;
datalines;
011 abc
;
ods select variables;
proc contents data=test;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the code, the INPUT statement reads the value for V2 using the BINARY informat, and the INFORMAT statement modifies the metadata for V2 to use the &lt;STRONG&gt;32.&lt;/STRONG&gt;&amp;nbsp; informat by default. The metadata shows the appropriate results:&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" summary="Procedure Contents: Variables" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c b header" colspan="6" scope="colgroup"&gt;Alphabetic List of Variables and Attributes&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r b header" scope="col"&gt;#&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Variable&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Type&lt;/TH&gt;
&lt;TH class="r b header" scope="col"&gt;Len&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Format&lt;/TH&gt;
&lt;TH class="l b header" scope="col"&gt;Informat&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data"&gt;V1&lt;/TD&gt;
&lt;TD class="l data"&gt;Num&lt;/TD&gt;
&lt;TD class="r data"&gt;8&lt;/TD&gt;
&lt;TD class="l data"&gt;Z3.&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data"&gt;V2&lt;/TD&gt;
&lt;TD class="l data"&gt;Num&lt;/TD&gt;
&lt;TD class="r data"&gt;8&lt;/TD&gt;
&lt;TD class="l data"&gt;Z3.&lt;/TD&gt;
&lt;TD class="l data"&gt;32.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="l data"&gt;V3&lt;/TD&gt;
&lt;TD class="l data"&gt;Char&lt;/TD&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;TD class="l data"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="l data"&gt;$UPCASE.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="l data"&gt;V4&lt;/TD&gt;
&lt;TD class="l data"&gt;Char&lt;/TD&gt;
&lt;TD class="r data"&gt;3&lt;/TD&gt;
&lt;TD class="l data"&gt;$REVERS3.&lt;/TD&gt;
&lt;TD class="l data"&gt;$UPCASE.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The values read in with various &lt;EM&gt;informats&lt;/EM&gt;, are later displayed using different &lt;EM&gt;formats&lt;/EM&gt;:&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.TEST" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;&lt;COLGROUP&gt; &lt;COL /&gt;&lt;/COLGROUP&gt; &lt;COLGROUP&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;V1&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;V2&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;V3&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;V4&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="r data"&gt;011&lt;/TD&gt;
&lt;TD class="r data"&gt;003&lt;/TD&gt;
&lt;TD class="l data"&gt;abc&lt;/TD&gt;
&lt;TD class="l data"&gt;CBA&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not inconsistency - it's flexibility. But with flexibility comes complexity, and with complexity the need to understand how the system works in order to achieve the desired result. If you want specific informat information in your metadata, you must use an INFORMAT statement to assign it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 12:42:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939862#M368981</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2024-08-19T12:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939865#M368982</link>
      <description>&lt;P&gt;Regard "inconsistency": this&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;has to be that way&lt;/STRONG&gt;&lt;/U&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is perfectly valid to have multiple INPUT statements&amp;nbsp;&lt;EM&gt;with different informats&lt;/EM&gt; for the same variable. In such a case, which of the informats should be stored in the datasets metadata? So it makes sense to not use the informat from an INPUT statement.&lt;/P&gt;
&lt;P&gt;OTOH, only one INFORMAT assignment for a variable will take effect (multiple informat assignments for the same variable are in fact a coding mistake, but SAS generously does not throw an ERROR and takes only the last).&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 12:34:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939865#M368982</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-19T12:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939873#M368984</link>
      <description>&lt;P&gt;I guess the inconsistency comes in when you consider that the fundamental computer science way to look at an informat is as a type. That is what it analogous in any other programming language I have used. It seems to be implemented quite differently however it is described in documentation and guides as the tool you use for typing. Therefore, I can expect (rightly or wrongly) that it will behave like a type. I can definitely see how what is described is internally consistent but not industry consistent. Perhaps I'm falling into a trap a little in assuming that SAS will behave like a mainstream programming language.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have finally found a piece of documentation stating that informats used in the input step are not stored but it wasn't even on the base input statement documentation, where it really should be, but buried away in a page on formats in the input step. I appreciate it is there but frustrating to find something important like that hidden.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At this point I don't think I'm looking for solutions thank you all for the assistance provided. The built in function that should have done exactly what I needed, vinformat, is inadequate due to this strange design of SAS not storing this metadata. I'm going to have to either reject the SAS informat way of storing ISO dates or build separate regexes for it.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 13:14:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939873#M368984</guid>
      <dc:creator>daid13</dc:creator>
      <dc:date>2024-08-19T13:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939876#M368985</link>
      <description>&lt;P&gt;SAS has two types of variables. Floating point numbers and fixed length character strings.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 13:26:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939876#M368985</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-19T13:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939877#M368986</link>
      <description>Yes I am aware of that. Informats are then expressed as the tool to have an item or collection of data in a more restricted form than the two types allow, that is why I am saying SAS uses informats as other languages would use types.</description>
      <pubDate>Mon, 19 Aug 2024 13:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939877#M368986</guid>
      <dc:creator>daid13</dc:creator>
      <dc:date>2024-08-19T13:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939911#M368990</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/468141"&gt;@daid13&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Yes I am aware of that. Informats are then expressed as the tool to have an item or collection of data in a more restricted form than the two types allow, that is why I am saying SAS uses informats as other languages would use types.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;INFORMATs convert text into values.&lt;/P&gt;
&lt;P&gt;FORMATs convert values into text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Neither is the same as variable TYPE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is not really any different than how other languages do formatted input and output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Computer jargon appropriates words from English and gives them special meaning.&amp;nbsp; &lt;A href="https://www.merriam-webster.com/dictionary/format" target="_blank"&gt;https://www.merriam-webster.com/dictionary/format&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In this case you seem to be trying to use the dictionary definition of the NOUN.&amp;nbsp; But the concept is SAS is closer to the definition of the VERB.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 15:59:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939911#M368990</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-19T15:59:26Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939942#M369004</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/468141"&gt;@daid13&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Informats are then expressed as the tool to have an item or collection of data in a more restricted form than the two types allow...&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't think I would say that at all.&amp;nbsp; Most typically, an informat is used to read a character value into a numeric value.&amp;nbsp; The official definition in the docs is more general: "&lt;SPAN&gt;An&amp;nbsp;&lt;/SPAN&gt;&lt;EM class="xisDoc-definedTerm"&gt;informat&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;is a type of SAS language element that applies a pattern to or executes instructions for a data value to be read as input.&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;TBH, I've never really understood why SAS stores informat information as part of the metadata in a dataset, because it's not a constraint on the values that can be stored in a variable (see integrity constraints), and I don't think you can easily "re-use" an informat attached to a SAS dataset.&amp;nbsp; I think of the informat used to read in data as a temporary construct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below code creates a SAS dataset with one variable, DT.&amp;nbsp; It's just a numeric variable, it can store any numeric value (this is allowed in a SAS dataset, precision limits etc).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  dt=input("19Aug2024",date9.) ; output ;
  dt=input("08/19/2024",mmddyy10.) ; output ;
  dt=23607 ;output ;
  dt=0 ;output ;
  dt=constant('pi') ;output ;
run ;  

proc print data=have ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Aug 2024 17:28:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939942#M369004</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-08-19T17:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939947#M369008</link>
      <description>&lt;P&gt;Attached informats had more value when using SAS/FSP for interactive entry/review of data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can still use them to help read data.&amp;nbsp; Say you have a CSV file and you want to read it into a dataset.&amp;nbsp; If you have a template dataset with all of the variables defined in the same order and appropriate informats attached then the code to read it could be as simple as:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile csv dsd truncover firstobs=2;
  if 0 then set template;
  input (_all_) (+0);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Aug 2024 17:45:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/939947#M369008</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-08-19T17:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/940241#M369075</link>
      <description>&lt;P&gt;If you want to recognize a sub-type (date, time, something else), do not look at informats, look at formats.&lt;/P&gt;
&lt;P&gt;You can define a SAS date variable as "is numeric, with a date format attached". Similar for times, currency amounts, ....&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 09:15:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/940241#M369075</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-08-21T09:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: Why Does Vinformat not return informat if informat was set by input?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/940316#M369091</link>
      <description>&lt;P&gt;Here is an only moderately contrived example of &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; and why a single variable may have multiple INFORMATS in actual use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   input repsource $ @;
   if repsource='Source1' then input date :date9.;
   else if repsource='Source2' then input date :yymmdd10.;
   else if repsource='Source3' then input date :julian.;
   format date date9. ;
datalines;
Source1 22AUG2024
Source2 2024/08/22:00:00:00.000000
Source3 24235
;
&lt;/PRE&gt;
&lt;P&gt;You may think this is completely made up. This is actually a simplified example of just one data source I dealt with. The "data" file to read was a text file that had been made by appending years of report files with similar but slightly different header outputs as time went on. So I had the joy of PARSING multiple report formats to apply standard rules. You may have a luxury of never dealing with such but the first input with the trailing @ holds the input on that line of the file. That way you can examine some of the contents to determine 1) is this the header record I need) 2) which header record type is it and then 3) read other values which will have different read requirements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, from that code, &lt;STRONG&gt;which&lt;/STRONG&gt; informat should be reported as "the informat" by VINFORMAT?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 14:48:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Why-Does-Vinformat-not-return-informat-if-informat-was-set-by/m-p/940316#M369091</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-21T14:48:49Z</dc:date>
    </item>
  </channel>
</rss>

