<?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: making the same format in every dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390584#M93729</link>
    <description>but also there are variables with different types : in set a var is numeric in set b var is char so setting them won't work</description>
    <pubDate>Thu, 24 Aug 2017 12:48:34 GMT</pubDate>
    <dc:creator>Jedrzej</dc:creator>
    <dc:date>2017-08-24T12:48:34Z</dc:date>
    <item>
      <title>making the same format in every dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390562#M93714</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have two data sets&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;set a&lt;/P&gt;&lt;P&gt;set b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;they have the same variables but&amp;nbsp; different formats values. Is there an easy way to make for example formats in set b the same as in set a ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 11:30:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390562#M93714</guid>
      <dc:creator>Jedrzej</dc:creator>
      <dc:date>2017-08-24T11:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: making the same format in every dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390564#M93716</link>
      <description>&lt;P&gt;Not sure exactly what you mean. Do you want to merge the format domain values, or use formats from b instead of in a?&lt;/P&gt;
&lt;P&gt;Give a simple example to illustrate your problem.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 11:35:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390564#M93716</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-08-24T11:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: making the same format in every dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390569#M93719</link>
      <description>&lt;P&gt;You can automate such a process by using dictionary.columns and a data step with call execute:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.class;
set sashelp.class;
run;

%let library=work;
%let col=age;
%let form=z10.;

proc sql;
create table control as
select memname from dictionary.columns
where upcase(libname) = upcase("&amp;amp;library.") and upcase(name) = upcase("&amp;amp;col.");
quit;

data _null_;
set control end=done;
if _n_ = 1
then call execute("proc datasets library=&amp;amp;library. nolist;");
call execute('modify ' !! trim(memname) !! ';');
call execute("attrib &amp;amp;col. format=&amp;amp;form.;");
if done then call execute('run;quit;');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You will see that dataset WORK.CLASS now displays the age with leading zeroes.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 11:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390569#M93719</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-24T11:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: making the same format in every dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390570#M93720</link>
      <description>example&lt;BR /&gt;&lt;BR /&gt;format of variable abc in set a is decimal&lt;BR /&gt;&lt;BR /&gt;variable abc in set in set b is integer.&lt;BR /&gt;&lt;BR /&gt;now i want variable abc in set a to be alson an integer.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 24 Aug 2017 11:51:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390570#M93720</guid>
      <dc:creator>Jedrzej</dc:creator>
      <dc:date>2017-08-24T11:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: making the same format in every dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390571#M93721</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if your columns are same in both datasets try this:&lt;/P&gt;&lt;PRE&gt;/*create test data*/&lt;BR /&gt;proc format;
   value $ gender
   'M'='Male'
   'F'='Female'
   ;
run;

data test1;
   set sashelp.class;
   format sex $gender.;
run;

data test2;
   set sashelp.class;
run;

data vcolumn;
   set sashelp.vcolumn;
   where libname eq 'WORK' and memname eq 'TEST1';
run;
&lt;BR /&gt;/*test code*/
data _NULL_;
   set vcolumn end=last;
   if _N_ eq 1 then call execute('data test2; set test2;');
   if not missing(format) then call execute('format '||strip(name)||' '||strip(format)||';');
   if last then call execute('run;');
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Aug 2017 11:52:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390571#M93721</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2017-08-24T11:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: making the same format in every dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390573#M93723</link>
      <description>&lt;P&gt;Whilst you have some examples of how to do it technically, I would question why you need to do this. &amp;nbsp;I mean if you have decimal values in a dataset, is it really a good idea to be displaying anything other than decimal - proc report output and such like would use the formatted values, but code wouldn't so you may end up with discrepantions and confusion. &amp;nbsp;I would fix why exactly this became an issue in the first place. &amp;nbsp;I have a fiver says this is linked to importing Excel files as normal.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 12:06:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390573#M93723</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-08-24T12:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: making the same format in every dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390576#M93725</link>
      <description>&lt;PRE&gt;
I don't understand. Once you set them together, the table b will follow the a's format .
You don't need to do anything .



data a;
 set sashelp.class;
 keep weight;
 format weight f10.2;
run;
data b;
 set sashelp.class;
 keep weight;
 format weight f10.;
run;

data want;
 set a b;
run;

&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Aug 2017 12:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390576#M93725</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-08-24T12:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: making the same format in every dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390584#M93729</link>
      <description>but also there are variables with different types : in set a var is numeric in set b var is char so setting them won't work</description>
      <pubDate>Thu, 24 Aug 2017 12:48:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390584#M93729</guid>
      <dc:creator>Jedrzej</dc:creator>
      <dc:date>2017-08-24T12:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: making the same format in every dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390588#M93730</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/107827"&gt;@Jedrzej&lt;/a&gt; wrote:&lt;BR /&gt;but also there are variables with different types : in set a var is numeric in set b var is char so setting them won't work&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then you need to align your variable types first. You can't have the same format for variables of different type, formats are either for numeric (no prefix) or character (prefix $) variables.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 12:59:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390588#M93730</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-24T12:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: making the same format in every dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390589#M93731</link>
      <description>&lt;P&gt;PS the fact that you not only have different formats, but also have incompatible types lets me suspect that your ETL process is faulty and probably based on using proc import, which is not suited for production work.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 13:01:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/making-the-same-format-in-every-dataset/m-p/390589#M93731</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-24T13:01:29Z</dc:date>
    </item>
  </channel>
</rss>

