<?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: Create a column &amp;quot;Month&amp;quot; for all the months in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442100#M282694</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=test.snow1a;
by month;
run;

proc transpose data=test.snow1a out=test.snow1a2(drop=_name_);
by Month;
id year;
where year&amp;gt;1991;
run;

proc print data=test.snow1a2;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now I am going to print out the last 10 years data set&lt;/P&gt;&lt;P&gt;Mine graph is as attached.&lt;/P&gt;&lt;P&gt;Do you think I can do anything for a column name as "Year"&lt;/P&gt;&lt;P&gt;Mine looked a bit not nice and neat&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help!!&lt;/P&gt;</description>
    <pubDate>Sat, 03 Mar 2018 20:53:45 GMT</pubDate>
    <dc:creator>jc3992</dc:creator>
    <dc:date>2018-03-03T20:53:45Z</dc:date>
    <item>
      <title>Create a column "Month" for all the months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442077#M282685</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data set is like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sep Oct Nov Dec Jan Feb Mar April May&lt;/P&gt;&lt;P&gt;x&amp;nbsp; &amp;nbsp; &amp;nbsp; y&amp;nbsp; &amp;nbsp; z&amp;nbsp; &amp;nbsp; &amp;nbsp; L&amp;nbsp; &amp;nbsp; &amp;nbsp; K&amp;nbsp; &amp;nbsp; A&amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; C&amp;nbsp; &amp;nbsp; &amp;nbsp; D&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I hope to create a column as:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sep&lt;/P&gt;&lt;P&gt;Oct&lt;/P&gt;&lt;P&gt;Nov&lt;/P&gt;&lt;P&gt;Dec&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jan&lt;/P&gt;&lt;P&gt;Feb&lt;/P&gt;&lt;P&gt;April&lt;/P&gt;&lt;P&gt;May&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I am going to use Transpose,&lt;/P&gt;&lt;P&gt;but there is not a variable named as "Month"&lt;/P&gt;&lt;P&gt;How can I create this variable and put the existing month in it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you~~&lt;/P&gt;</description>
      <pubDate>Sat, 03 Mar 2018 18:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442077#M282685</guid>
      <dc:creator>jc3992</dc:creator>
      <dc:date>2018-03-03T18:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create a column "Month" for all the months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442078#M282686</link>
      <description>&lt;P&gt;If that's the column names you don't need to specify it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try a TRANSPOSE without anything else&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=have out=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 03 Mar 2018 18:40:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442078#M282686</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-03T18:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create a column "Month" for all the months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442080#M282687</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for replying:)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data looks like the attached.&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data snow1;
set "C:\Users\jc3992\Downloads\snow1.sas7bdat";
proc print data=snow1;
title "snow1";
run;
proc transpose data=snow1 out=snow1a;
by year;
var month=sep--may;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The LOG showed:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;166  proc transpose data=snow1 out=snow1a;
167  by year;
168  var month=sep--may;
              -
              22
              200
ERROR: Variable MONTH not found.
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, -, :, _ALL_,
              _CHARACTER_, _CHAR_, _NUMERIC_.
ERROR 200-322: The symbol is not recognized and will be ignored.
169  run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.SNOW1A may be incomplete.  When this step was stopped there were 0
         observations and 0 variables.
WARNING: Data set WORK.SNOW1A was not replaced because this step was stopped.
NOTE: PROCEDURE TRANSPOSE used (Total process time):
      real time           0.33 seconds
      cpu time            0.01 seconds


&lt;/PRE&gt;</description>
      <pubDate>Sat, 03 Mar 2018 18:53:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442080#M282687</guid>
      <dc:creator>jc3992</dc:creator>
      <dc:date>2018-03-03T18:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Create a column "Month" for all the months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442082#M282688</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
length Sep	Oct	Nov	Dec	Jan	Feb	Mar	Apr	May 8;
run;

proc transpose data=have(obs=0) out=want name=month;
var sep--may;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 03 Mar 2018 19:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442082#M282688</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-03T19:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create a column "Month" for all the months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442086#M282689</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for helping me out &amp;gt;"&amp;lt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dirdata=C:\Users\jc3992\My SAS Data;
libname Test "&amp;amp;dirdata";
run;

data snow1;
set "C:\Users\jc3992\Downloads\snow1.sas7bdat";
proc print data=snow1;
run;

data work.snow1;
length Sep Oct Nov	Dec	Jan	Feb	Mar	Apr	May 8;
run;

proc transpose data=work.snow1(obs=118) out=test.snow1a name=month prefix=snowfall;
var sep--may;
by year;
run;

proc print data=snow1a;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The LOG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;275  %let dirdata=C:\Users\jc3992\My SAS Data;
276  libname Test "&amp;amp;dirdata";
NOTE: Libref TEST refers to the same physical library as DIRDATA.
NOTE: Libref TEST was successfully assigned as follows:
      Engine:        V9
      Physical Name: C:\Users\jc3992\My SAS Data
277  run;
278
279  data snow1;
280  set "C:\Users\jc3992\Downloads\snow1.sas7bdat";

NOTE: There were 118 observations read from the data set
      C:\Users\jc3992\Downloads\snow1.sas7bdat.
NOTE: The data set WORK.SNOW1 has 118 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds


281  proc print data=snow1;
282  run;

NOTE: There were 118 observations read from the data set WORK.SNOW1.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 seconds


283
284  data work.snow1;
285  length Sep Oct Nov  Dec Jan Feb Mar Apr May 8;
286  run;

NOTE: Variable Sep is uninitialized.
NOTE: Variable Oct is uninitialized.
NOTE: Variable Nov is uninitialized.
NOTE: Variable Dec is uninitialized.
NOTE: Variable Jan is uninitialized.
NOTE: Variable Feb is uninitialized.
NOTE: Variable Mar is uninitialized.
NOTE: Variable Apr is uninitialized.
NOTE: Variable May is uninitialized.
NOTE: The data set WORK.SNOW1 has 1 observations and 9 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


287
288  proc transpose data=work.snow1(obs=118) out=test.snow1a name=month prefix=snowfall;
289  var sep--may;
290  by year;
ERROR: Variable YEAR not found.
291  run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set TEST.SNOW1A may be incomplete.  When this step was stopped there were 0
         observations and 0 variables.
NOTE: PROCEDURE TRANSPOSE used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

292


293  proc print data=snow1a;
294  run;

NOTE: There were 9 observations read from the data set WORK.SNOW1A.
NOTE: PROCEDURE PRINT used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


&lt;/PRE&gt;&lt;P&gt;The output SNOW1A still is unsuccessful...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Mar 2018 20:14:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442086#M282689</guid>
      <dc:creator>jc3992</dc:creator>
      <dc:date>2018-03-03T20:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create a column "Month" for all the months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442091#M282690</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/188695"&gt;@jc3992&lt;/a&gt;&amp;nbsp;, I was just playing to show a simple demonstration. I get the impression you need to really get the hang of all the basic concepts of SAS language datastep/proc so that you can feel comfortable. Don't worry. I was like you 3-4 years ago. We all learn. I'd suggest get some books and read to familiarize the concepts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me request Reeza, as she often helps out folks with some links to video tutorials/ other related links.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp; ,Can you please share those links the OP may use to come up to speed?&lt;/P&gt;</description>
      <pubDate>Sat, 03 Mar 2018 20:33:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442091#M282690</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-03T20:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Create a column "Month" for all the months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442097#M282691</link>
      <description>&lt;P&gt;Just to complete your request:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines expandtabs truncover;
input Obs	Year	Sep	Oct	Nov	Dec	Jan	Feb	Mar	Apr	May;
datalines;
1	1884	0	0.0	1.0	27.1	22.2	17.0	3.5	19.5	0.0
2	1885	0	1.7	8.2	8.4	16.9	16.0	6.5	7.0	0.0
3	1886	0	0.0	22.2	12.5	12.0	18.4	6.3	1.2	0.0
4	1887	0	0.2	2.2	9.3	21.3	4.1	13.2	0.4	0.0
5	1888	0	0.0	4.0	15.5	17.8	22.0	17.5	5.4	0.0
6	1889	0	0.0	5.7	6.1	20.2	14.8	19.0	0.0	0.0
7	1890	0	0.0	2.1	29.2	16.1	24.6	12.2	0.3	0.1
8	1891	0	0.1	9.7	4.7	26.4	10.3	25.1	0.8	0.0
9	1892	0	0.0	14.0	19.2	15.9	29.8	8.1	9.6	0.0
10	1893	0	0.5	6.1	27.6	20.0	29.5	5.4	13.3	0.0
11	1894	0	0.0	11.1	22.1	26.5	23.6	9.5	0.6	0.0
12	1895	0	1.5	5.9	8.7	22.5	39.1	45.1	1.0	0.0
13	1896	0	0.0	5.5	13.9	20.1	13.7	8.1	5.2	0.0
14	1897	0	0.0	10.1	18.4	32.1	26.8	1.2	2.4	0.0
15	1898	0	0.0	10.6	27.0	16.6	16.3	21.2	4.3	0.0
16	1899	0	0.0	1.3	21.5	24.7	28.5	54.0		
;


proc transpose data=have out=want name=month;
by year;
var sep--may;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 03 Mar 2018 20:44:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442097#M282691</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-03T20:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create a column "Month" for all the months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442098#M282692</link>
      <description>&lt;P&gt;Thank you very very much!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The thing is I have too little time for familiarizing SAS,&lt;/P&gt;&lt;P&gt;and we have assignment every week&lt;/P&gt;&lt;P&gt;(I also got other subjects with tests and assignments every week &amp;gt;"&amp;lt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;I watched some vid on Youtube too&lt;/P&gt;&lt;P&gt;it would be great if you guys can help me out more on this.&lt;/P&gt;&lt;P&gt;I found a Youtube channel titled "SAS ...for true beginners " that was really helpful&lt;/P&gt;&lt;P&gt;sadly the owner did not upload anything anymore after four vids&lt;/P&gt;&lt;P&gt;Hope you both can offer us beginners some guidance!:)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Mar 2018 20:50:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442098#M282692</guid>
      <dc:creator>jc3992</dc:creator>
      <dc:date>2018-03-03T20:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Create a column "Month" for all the months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442099#M282693</link>
      <description>&lt;P&gt;Always willing to help(it's just i'm just too lazy i'm afraid). Pardon me, I meant the above comment more on the affirmative and not to point your weakness.&amp;nbsp; All the best for your assignments and I hope you do well. Have a great weekend.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Mar 2018 20:53:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442099#M282693</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-03-03T20:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Create a column "Month" for all the months</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442100#M282694</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=test.snow1a;
by month;
run;

proc transpose data=test.snow1a out=test.snow1a2(drop=_name_);
by Month;
id year;
where year&amp;gt;1991;
run;

proc print data=test.snow1a2;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now I am going to print out the last 10 years data set&lt;/P&gt;&lt;P&gt;Mine graph is as attached.&lt;/P&gt;&lt;P&gt;Do you think I can do anything for a column name as "Year"&lt;/P&gt;&lt;P&gt;Mine looked a bit not nice and neat&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help!!&lt;/P&gt;</description>
      <pubDate>Sat, 03 Mar 2018 20:53:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-column-quot-Month-quot-for-all-the-months/m-p/442100#M282694</guid>
      <dc:creator>jc3992</dc:creator>
      <dc:date>2018-03-03T20:53:45Z</dc:date>
    </item>
  </channel>
</rss>

