<?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 Format problem in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Format-problem/m-p/722916#M27929</link>
    <description>&lt;P&gt;dear SAS experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use this Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;* Neues Format für die Berechnung der Durchschnitte für n Monate ;
proc format;
value ytd (multilabel) 
1							='Jan'
1,2							='Feb' 
1,2,3						='Mar'
1,2,3,4						='Apr'
1,2,3,4,5					='Mai'
1,2,3,4,5,6					='Jun'
1,2,3,4,5,6,7				='Jul'
1,2,3,4,5,6,7,8				='Aug'
1,2,3,4,5,6,7,8,9			='Sep'
1,2,3,4,5,6,7,8,9,10		='Oct'
1,2,3,4,5,6,7,8,9,10,11		='Nov'
1,2,3,4,5,6,7,8,9,10,11,12	='Dec'
; 
run;

proc format;
value miz 
1	=	'Jan'
2	=	'Feb' 
3	= 	'Mar'
4	=	'Apr'
5	=	'Mai'
6	=	'Jun'
7	=	'Jul'
8	=	'Aug'
9	=	'Sep'
10	=	'Oct'
11	=	'Nov'
12	=	'Dec'
; 
run;

* Berechnung der monatlichen Summen, FIL Ebene ;
proc summary data=Dashboard_Primaerdaten nway;  
class marktregion_bt nlbez_bt mbrbez_bt filbez_bt FILHB_BT jahr ;
class monat ;
var  ORB: NGS: DrK: ;
output out=FIL1 sum=;
run;
proc sort data=FIL1; by marktregion_bt nlbez_bt mbrbez_bt filbez_bt FILHB_BT jahr monat; run;
data FIL2 (drop=Monat);
set FIL1;
format monat miz.;
Monat_2 = cats(jahr,monat,'Somme');
run;

* Berechnung der monatlichen Durchschnitte, FIL Ebene ;
proc summary data=FIL1 nway;
    class marktregion_bt nlbez_bt mbrbez_bt filbez_bt FILHB_BT jahr;
	class monat/mlf;
    var ORB: NGS: DrK: ;
    output out=FIL3 mean=;
    format monat ytd.;
run;
data FIL3 (drop=monat);
set FIL3;
Monat_2 = cats(jahr,monat,'Moy');
run;

* Berechnung der jährlichen Summen, FIL Ebene ;
proc summary data=Dashboard_Primaerdaten nway;  
class marktregion_bt nlbez_bt mbrbez_bt filbez_bt FILHB_BT jahr ;
var  ORB: NGS: DrK: ;
output out=FIL4 sum=;
run;
data FIL4;
set FIL4;
Monat_2 = cats(jahr,'Jahr');
run;&lt;/PRE&gt;&lt;P&gt;The variable Monat is numeric and has values from 1 to 12. My Problem is the result of MONAT_2.&lt;/P&gt;&lt;P&gt;In the dataset FIL2 I get the following : 20201Somme (Year = 2020, Month = 1)&lt;/P&gt;&lt;P&gt;In the Dataset FIL3 I get the following: 2020JanMoy&lt;/P&gt;&lt;P&gt;I would like the result in FIL2 to be similar to : 2020JanSomme (instead of 20201Somme)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What should I modify to obtain this result?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;PY&lt;/P&gt;</description>
    <pubDate>Tue, 02 Mar 2021 17:14:49 GMT</pubDate>
    <dc:creator>PierreYvesILY</dc:creator>
    <dc:date>2021-03-02T17:14:49Z</dc:date>
    <item>
      <title>Format problem</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Format-problem/m-p/722916#M27929</link>
      <description>&lt;P&gt;dear SAS experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use this Code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;* Neues Format für die Berechnung der Durchschnitte für n Monate ;
proc format;
value ytd (multilabel) 
1							='Jan'
1,2							='Feb' 
1,2,3						='Mar'
1,2,3,4						='Apr'
1,2,3,4,5					='Mai'
1,2,3,4,5,6					='Jun'
1,2,3,4,5,6,7				='Jul'
1,2,3,4,5,6,7,8				='Aug'
1,2,3,4,5,6,7,8,9			='Sep'
1,2,3,4,5,6,7,8,9,10		='Oct'
1,2,3,4,5,6,7,8,9,10,11		='Nov'
1,2,3,4,5,6,7,8,9,10,11,12	='Dec'
; 
run;

proc format;
value miz 
1	=	'Jan'
2	=	'Feb' 
3	= 	'Mar'
4	=	'Apr'
5	=	'Mai'
6	=	'Jun'
7	=	'Jul'
8	=	'Aug'
9	=	'Sep'
10	=	'Oct'
11	=	'Nov'
12	=	'Dec'
; 
run;

* Berechnung der monatlichen Summen, FIL Ebene ;
proc summary data=Dashboard_Primaerdaten nway;  
class marktregion_bt nlbez_bt mbrbez_bt filbez_bt FILHB_BT jahr ;
class monat ;
var  ORB: NGS: DrK: ;
output out=FIL1 sum=;
run;
proc sort data=FIL1; by marktregion_bt nlbez_bt mbrbez_bt filbez_bt FILHB_BT jahr monat; run;
data FIL2 (drop=Monat);
set FIL1;
format monat miz.;
Monat_2 = cats(jahr,monat,'Somme');
run;

* Berechnung der monatlichen Durchschnitte, FIL Ebene ;
proc summary data=FIL1 nway;
    class marktregion_bt nlbez_bt mbrbez_bt filbez_bt FILHB_BT jahr;
	class monat/mlf;
    var ORB: NGS: DrK: ;
    output out=FIL3 mean=;
    format monat ytd.;
run;
data FIL3 (drop=monat);
set FIL3;
Monat_2 = cats(jahr,monat,'Moy');
run;

* Berechnung der jährlichen Summen, FIL Ebene ;
proc summary data=Dashboard_Primaerdaten nway;  
class marktregion_bt nlbez_bt mbrbez_bt filbez_bt FILHB_BT jahr ;
var  ORB: NGS: DrK: ;
output out=FIL4 sum=;
run;
data FIL4;
set FIL4;
Monat_2 = cats(jahr,'Jahr');
run;&lt;/PRE&gt;&lt;P&gt;The variable Monat is numeric and has values from 1 to 12. My Problem is the result of MONAT_2.&lt;/P&gt;&lt;P&gt;In the dataset FIL2 I get the following : 20201Somme (Year = 2020, Month = 1)&lt;/P&gt;&lt;P&gt;In the Dataset FIL3 I get the following: 2020JanMoy&lt;/P&gt;&lt;P&gt;I would like the result in FIL2 to be similar to : 2020JanSomme (instead of 20201Somme)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What should I modify to obtain this result?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;PY&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 17:14:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Format-problem/m-p/722916#M27929</guid>
      <dc:creator>PierreYvesILY</dc:creator>
      <dc:date>2021-03-02T17:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: Format problem</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Format-problem/m-p/722922#M27930</link>
      <description>&lt;P&gt;try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Monat_2 = cats(jahr,put(monat,miz.),'Somme');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;it looks like you have a&amp;nbsp;situation like in this example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 a = 10;
 b = 20;
 format a b date9.;
 c=cats(a,b);
 put _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 17:27:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Format-problem/m-p/722922#M27930</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2021-03-02T17:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Format problem</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Format-problem/m-p/722923#M27931</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;In the dataset FIL2 I get the following : 20201Somme (Year = 2020, Month = 1)&lt;/P&gt;
&lt;P&gt;In the Dataset FIL3 I get the following: 2020JanMoy&lt;/P&gt;
&lt;P&gt;I would like the result in FIL2 to be similar to : 2020JanSomme (instead of 20201Somme)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What should I modify to obtain this result?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If you look at the two data steps you should see the only difference in FIL2 is the format assigned to monat&lt;/P&gt;
&lt;P&gt;Don't use the format. the CAT functions will use the assigned format for variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 17:28:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Format-problem/m-p/722923#M27931</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-02T17:28:46Z</dc:date>
    </item>
  </channel>
</rss>

