<?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: Telling the diff between system and user formats in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/304034#M64671</link>
    <description>&lt;P&gt;If you don't have them defined SAS doesn't know they exist and can't use them. Usually if you try and open a dataset with user defined formats&amp;nbsp;that you don't have declared somewhere then you'll get an error. Unless you've set the NOFMTERROR option.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If they are defined use CNTLOUT to dump the definitions to dataset.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc format cntlout=format_defns;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's hard to understand exactly what you're trying to do or achieve here. Your initial question was answered but it appears to not be your actual question. Please be more descriptive with what you're trying to do if you need further help. The answer above is a guess.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Oct 2016 12:17:46 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-10-12T12:17:46Z</dc:date>
    <item>
      <title>Telling the diff between system and user formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/303849#M64603</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been tasked with counting the number of formats assigned to about 300 datasets within a bunch of folders.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've already got all of the libnames assigned and i have a table with the dictionary.columns information, which has the FORMAT variable, but it's filled with 12k records, and some are user defined formats and some are system formats (date fields, lengths, etc).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there an easy way to split these?&amp;nbsp; Does SAS record a system formats flag somewhere?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2016 19:02:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/303849#M64603</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-10-11T19:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Telling the diff between system and user formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/303860#M64610</link>
      <description>&lt;P&gt;Depends on how you're storing them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But take a look at sashelp.vformat and see if you can filter them out. SAS formats have the path field filled out, but the user defined formats may not. And the libname doesn't appear to be assigned for system formats either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So user defined formats are possibly identified via:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data user_formats;
set sashelp.vformat;
where not missing(libname);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Oct 2016 19:40:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/303860#M64610</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-11T19:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Telling the diff between system and user formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/303920#M64637</link>
      <description>&lt;P&gt;After running the following code, you will see customize format have FormatSource='C' .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value myfmt
 1='F'
 2='M';
run;

proc sql;
create table format as
 select * from dictionary.formats;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Oct 2016 02:56:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/303920#M64637</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-10-12T02:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Telling the diff between system and user formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/304021#M64666</link>
      <description>&lt;P&gt;When i filter this dictionary table to just the libnames i want i get no results.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 11:50:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/304021#M64666</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-10-12T11:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Telling the diff between system and user formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/304023#M64667</link>
      <description>&lt;P&gt;For the sake of the post, let's assume i have multiple datasets and no catalog to go with.&amp;nbsp; I just have datasets with formats assigned in them.&amp;nbsp; And i want to be able to tell the difference between user defined and system defined.&amp;nbsp; I found the vformat table and it looks like it's all system defined.&amp;nbsp; There's no libname for any of them.&amp;nbsp; When i ran the format that (I can't see now who it was since i don't have the entire post on the reply screen) the other commenter included and re-ran it, then it selected that one out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i don't have the proc format code.&amp;nbsp; I'm not running the formats.&amp;nbsp; They're already in the datasets.&amp;nbsp; But it looks like they only get added to vformat during the session in which they're run.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 11:54:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/304023#M64667</guid>
      <dc:creator>MeganE</dc:creator>
      <dc:date>2016-10-12T11:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: Telling the diff between system and user formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/304034#M64671</link>
      <description>&lt;P&gt;If you don't have them defined SAS doesn't know they exist and can't use them. Usually if you try and open a dataset with user defined formats&amp;nbsp;that you don't have declared somewhere then you'll get an error. Unless you've set the NOFMTERROR option.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If they are defined use CNTLOUT to dump the definitions to dataset.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc format cntlout=format_defns;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's hard to understand exactly what you're trying to do or achieve here. Your initial question was answered but it appears to not be your actual question. Please be more descriptive with what you're trying to do if you need further help. The answer above is a guess.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 12:17:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/304034#M64671</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-10-12T12:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Telling the diff between system and user formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/304062#M64681</link>
      <description>&lt;P&gt;You get eventually no results because the format names assigned to variables don't exactly match the "base" format names - eg. $12. would be "base" format $.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Examine below working code which uses what &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp﻿&lt;/a&gt;&amp;nbsp;proposed for identifying OOTB formats. This sample code will hopefully give you some guidance&amp;nbsp;how you can achieve what you're after.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  value justATest
    1='test'
  ;
run;
data test;
  format a justATest1.;
  a=1;
run;

/* formats in datasets in selected libraries */
proc sql;
  create table DistinctFormatsInLibs as
  select distinct 
    format,
    upcase(substrn(format,1,findc(format,'$','ba'))) as Format_Name
  from dictionary.columns
  where libname in ('SASHELP','WORK') and not missing(format) 
  ;
quit;

/* OOTB  Formats */
proc sql;
  create table OOTB_Formats as
  select upcase(fmtname) as fmtname
  from dictionary.formats
  where fmttype='F' and source ne 'C'
  order by fmtname
  ;
quit;

/* Report */
proc sql;
  create table want as
  select
    l.format as Format_Applied,
    l.Format_Name,
    case
      when(l.Format_Name='' or r.fmtname ne '') then '1'
      else '0'
      end
      as OOTB_FMT_FLG
  from 
    DistinctFormatsInLibs as L
    left join
    OOTB_Formats as R
      on l.Format_Name=r.fmtname
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 13:33:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/304062#M64681</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-10-12T13:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Telling the diff between system and user formats</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/304106#M64691</link>
      <description>&lt;P&gt;It is very possible that the library the format is in does not match the library the data set using it is in. Some organizations have shared custom formats placed in a central library but the data using them could be scattered.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Oct 2016 14:53:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Telling-the-diff-between-system-and-user-formats/m-p/304106#M64691</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-12T14:53:43Z</dc:date>
    </item>
  </channel>
</rss>

