<?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: SGPlot temperature trend in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/841877#M332883</link>
    <description>&lt;P&gt;If you have data that goes from 2000 to 2020, and each has weeks 1, 2, 3, ... , 52, then your data set has 21 different values for week1 and your plot shows 21 different values for week 1. You did not instruct PROC SGPLOT to use YEAR in the creation of the plot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead, you really ought to work with actual SAS date values, which are numeric values indicating the number of days since 01JAN1960. This is a common mistake beginners make, they do not use SAS date values. If you do use SAS date values, then the plot will work, as both year and week are encoded into the SAS date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data two;
    set one;
    year_week=mdy(1,1,year)+(week-1)*7;
    format year_week year4.;
run;
proc sgplot data=exposure; where country='A';
    series x=year_week y=mean_temp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The MDY function determines the first day of the year and then we add 7 days times the number of weeks to the first day of the year. So by using actual SAS date values (number of days since 01JAN1960), we now have days representing weeks from 01JAN2000 to the last week of 2020.&lt;/P&gt;</description>
    <pubDate>Tue, 01 Nov 2022 14:14:49 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-11-01T14:14:49Z</dc:date>
    <item>
      <title>SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/841869#M332882</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;I want to plot weekly averages from 1999 to 2020 to see a trend over time. In my data, I have several municipalities and for each municipality I have weekly averages for all the years. Below is an example of the data. In the original data, there are several municipalities and years are until 2020.&lt;/P&gt;
&lt;P&gt;data temp; &lt;BR /&gt;input country $ muncipality $ weeknumber $ year $ mean_temperature ; &lt;BR /&gt;datalines; &lt;BR /&gt;A X 1 2000 -8.0&lt;BR /&gt;A X 2 2000 -12.03&lt;BR /&gt;A X 3 2000 -1.40&lt;BR /&gt;A X 4 2000 -20.13&lt;BR /&gt;A X 5 2000 -11.07&lt;BR /&gt;A X 6 2000 -15.20&lt;BR /&gt;A X 7 2000 -5.07&lt;BR /&gt;A X 8 2000 -5.6 &lt;BR /&gt;A X 9 2000 -5.8&lt;BR /&gt;A X 10 2000 -6.0&lt;BR /&gt;A X 11 2000 -1.48&lt;BR /&gt;A X 12 2000 -0.44&lt;BR /&gt;A X 13 2000 1.74&lt;BR /&gt;A X 14 2000 2.9&lt;BR /&gt;A X 15 2000 3.52&lt;BR /&gt;A X 16 2000 7.3&lt;BR /&gt;A X 17 2000 3.97&lt;BR /&gt;A X 18 2000 1.88&lt;BR /&gt;A X 19 2000 3.66&lt;BR /&gt;A X 20 2000 11.05&lt;BR /&gt;A X 21 2000 9.25&lt;BR /&gt;A X 22 2000 12.34&lt;BR /&gt;A X 23 2000 16.78&lt;BR /&gt;A X 24 2000 18.52&lt;BR /&gt;A X 25 2000 17.95&lt;BR /&gt;A X 26 2000 17.82&lt;BR /&gt;A X 27 2000 15.82&lt;BR /&gt;A X 28 2000 19.44&lt;BR /&gt;A X 29 2000 16.3&lt;BR /&gt;A X 30 2000 13.75&lt;BR /&gt;A X 31 2000 14.75&lt;BR /&gt;A X 32 2000 12.18&lt;BR /&gt;A X 33 2000 10.12&lt;BR /&gt;A X 34 2000 11.84&lt;BR /&gt;A X 35 2000 14.96&lt;BR /&gt;A X 36 2000 12.48&lt;BR /&gt;A X 37 2000 7.34&lt;BR /&gt;A X 38 2000 7.5&lt;BR /&gt;A X 39 2000 9.50&lt;BR /&gt;A X 40 2000 7.75&lt;BR /&gt;A X 41 2000 3.84&lt;BR /&gt;A X 42 2000 1.42&lt;BR /&gt;A X 43 2000 4.29&lt;BR /&gt;A X 44 2000 5.05&lt;BR /&gt;A X 45 2000 2.52&lt;BR /&gt;A X 46 2000 -4.7&lt;BR /&gt;A X 47 2000 0.14&lt;BR /&gt;A X 48 2000 -2.48&lt;BR /&gt;A X 49 2000 -7.2&lt;BR /&gt;A X 50 2000 -5.85&lt;BR /&gt;A X 51 2000 -2.89&lt;BR /&gt;A X 52 2000 -5.55&lt;BR /&gt;A Y 1 2000 -5.67&lt;BR /&gt;A Y 2 2000 -7.54&lt;BR /&gt;A Y 3 2000 0.71&lt;BR /&gt;A Y 4 2000 -16.74&lt;BR /&gt;A Y 5 2000 -8.78&lt;BR /&gt;A Y 6 2000 -12.80&lt;BR /&gt;A Y 7 2000 -5.3&lt;BR /&gt;A Y 8 2000 -4.09&lt;BR /&gt;A Y 9 2000 -5.50&lt;BR /&gt;A Y 10 2000 -1.10&lt;BR /&gt;A Y 11 2000 0.65&lt;BR /&gt;A Y 12 2000 2.3&lt;BR /&gt;A Y 13 2000 3.5&lt;BR /&gt;A Y 14 2000 4.45&lt;BR /&gt;A Y 15 2000 8.32&lt;BR /&gt;A Y 16 2000 5.68&lt;BR /&gt;A Y 17 2000 4.45&lt;BR /&gt;A Y 18 2000 8.32&lt;BR /&gt;A Y 19 2000 5.48&lt;BR /&gt;A Y 20 2000 3.89&lt;BR /&gt;A Y 21 2000 5.17&lt;BR /&gt;A Y 22 2000 3.76&lt;BR /&gt;A Y 23 2000 12.3&lt;BR /&gt;A Y 24 2000 14.05&lt;BR /&gt;A Y 25 2000 17.20&lt;BR /&gt;A Y 26 2000 18.20&lt;BR /&gt;A Y 27 2000 16.82&lt;BR /&gt;A Y 28 2000 20.45&lt;BR /&gt;A Y 29 2000 17.77&lt;BR /&gt;A Y 30 2000 15.68&lt;BR /&gt;A Y 31 2000 16.05&lt;BR /&gt;A Y 32 2000 10.65&lt;BR /&gt;A Y 33 2000 11.65&lt;BR /&gt;A Y 34 2000 10.47&lt;BR /&gt;A Y 35 2000 12.20&lt;BR /&gt;A Y 36 2000 13.20&lt;BR /&gt;A Y 37 2000 8.32&lt;BR /&gt;A Y 38 2000 8.90&lt;BR /&gt;A Y 39 2000 11.82&lt;BR /&gt;A Y 40 2000 7.45&lt;BR /&gt;A Y 41 2000 7.77&lt;BR /&gt;A Y 42 2000 2.62&lt;BR /&gt;A Y 43 2000 5.89&lt;BR /&gt;A Y 44 2000 7.77&lt;BR /&gt;A Y 45 2000 5.62&lt;BR /&gt;A Y 46 2000 -4.45&lt;BR /&gt;A Y 47 2000 -3.78&lt;BR /&gt;A Y 48 2000 -1.90&lt;BR /&gt;A Y 49 2000 -2.78&lt;BR /&gt;A Y 50 2000 -4.09&lt;BR /&gt;A Y 51 2000 -2.43&lt;BR /&gt;A Y 52 2000 -6.78&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to make a plot showing me trend in temperature from 2000 to 2020. Below is an example I want. I removed the labls since it is from original data. y axis are values and x-axis are week numbers and years. This was made in excel.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Raza_M_0-1667310390854.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76843iAFC8BE38840E9C15/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Raza_M_0-1667310390854.png" alt="Raza_M_0-1667310390854.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;However, when i write the following code it give me a graph of values averaged over weeks from all the years.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data=exposure; where country='A';&lt;BR /&gt;series x=weeknumber y=mean_temp;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I get the following output&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Raza_M_2-1667310781721.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76845i75DF3F873603A070/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Raza_M_2-1667310781721.png" alt="Raza_M_2-1667310781721.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to understand where am I wrong. Your help is highly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 13:54:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/841869#M332882</guid>
      <dc:creator>Raza_M</dc:creator>
      <dc:date>2022-11-01T13:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/841877#M332883</link>
      <description>&lt;P&gt;If you have data that goes from 2000 to 2020, and each has weeks 1, 2, 3, ... , 52, then your data set has 21 different values for week1 and your plot shows 21 different values for week 1. You did not instruct PROC SGPLOT to use YEAR in the creation of the plot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead, you really ought to work with actual SAS date values, which are numeric values indicating the number of days since 01JAN1960. This is a common mistake beginners make, they do not use SAS date values. If you do use SAS date values, then the plot will work, as both year and week are encoded into the SAS date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data two;
    set one;
    year_week=mdy(1,1,year)+(week-1)*7;
    format year_week year4.;
run;
proc sgplot data=exposure; where country='A';
    series x=year_week y=mean_temp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The MDY function determines the first day of the year and then we add 7 days times the number of weeks to the first day of the year. So by using actual SAS date values (number of days since 01JAN1960), we now have days representing weeks from 01JAN2000 to the last week of 2020.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 14:14:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/841877#M332883</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-01T14:14:49Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/841880#M332884</link>
      <description>Thank you for replying and point out the mistake!&lt;BR /&gt;However, when i write your syntax I get error and created variables have all missing values.&lt;BR /&gt;&lt;BR /&gt;687  data exposure;&lt;BR /&gt;688   set exposure;&lt;BR /&gt;689      year_week=mdy(1,1,year)+(week-1)*7;&lt;BR /&gt;690      format year_week year4.;&lt;BR /&gt;691  run;&lt;BR /&gt;&lt;BR /&gt;NOTE: Missing values were generated as a result of performing an operation on missing values.&lt;BR /&gt;      Each place is given by: (Number of times) at (Line):(Column).&lt;BR /&gt;      652292 at 689:34&lt;BR /&gt;NOTE: There were 652292 observations read from the data set WORK.EXPOSURE.&lt;BR /&gt;NOTE: The data set WORK.EXPOSURE has 652292 observations and 13 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;      real time           0.14 seconds&lt;BR /&gt;      cpu time            0.15 seconds&lt;BR /&gt;</description>
      <pubDate>Tue, 01 Nov 2022 14:26:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/841880#M332884</guid>
      <dc:creator>Raza_M</dc:creator>
      <dc:date>2022-11-01T14:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/841883#M332885</link>
      <description>&lt;P&gt;Reason: You did not provide any Year related information to graph. Second your data has a variable, muncipality (really is that the spelling you used?), that means that you have duplicate week/year combinations and nothing in the graph to handle them. So if your X axis is used correctly the data points will connect muncipality values for the same date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Possible even worse, your Year and Weeknumber variables are CHARACTER if your data step is correct. Which means sort order is extremely problematic on the X axis as week 11 comes before week 2 in character values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a modification of your data step that creates an actual date value to use. This step would likely have been easier with data before the week summary as the Informats for&amp;nbsp; reading weeks are not very flexible. I also modify the SGplot code to handle "muncipality" date repetition.&lt;/P&gt;
&lt;PRE&gt;data temp;
input country $ muncipality $ weeknumber $ year $ mean_temperature ;
date = input(catx('W',substr(year,3),put(input(weeknumber,2.),z2.)),Weeku5.);
format date date9.;
datalines;
A X 1 2000 -8.0
A X 2 2000 -12.03
A X 3 2000 -1.40
A X 4 2000 -20.13
A X 5 2000 -11.07
A X 6 2000 -15.20
A X 7 2000 -5.07
A X 8 2000 -5.6
A X 9 2000 -5.8
A X 10 2000 -6.0
A X 11 2000 -1.48
A X 12 2000 -0.44
A X 13 2000 1.74
A X 14 2000 2.9
A X 15 2000 3.52
A X 16 2000 7.3
A X 17 2000 3.97
A X 18 2000 1.88
A X 19 2000 3.66
A X 20 2000 11.05
A X 21 2000 9.25
A X 22 2000 12.34
A X 23 2000 16.78
A X 24 2000 18.52
A X 25 2000 17.95
A X 26 2000 17.82
A X 27 2000 15.82
A X 28 2000 19.44
A X 29 2000 16.3
A X 30 2000 13.75
A X 31 2000 14.75
A X 32 2000 12.18
A X 33 2000 10.12
A X 34 2000 11.84
A X 35 2000 14.96
A X 36 2000 12.48
A X 37 2000 7.34
A X 38 2000 7.5
A X 39 2000 9.50
A X 40 2000 7.75
A X 41 2000 3.84
A X 42 2000 1.42
A X 43 2000 4.29
A X 44 2000 5.05
A X 45 2000 2.52
A X 46 2000 -4.7
A X 47 2000 0.14
A X 48 2000 -2.48
A X 49 2000 -7.2
A X 50 2000 -5.85
A X 51 2000 -2.89
A X 52 2000 -5.55
A Y 1 2000 -5.67
A Y 2 2000 -7.54
A Y 3 2000 0.71
A Y 4 2000 -16.74
A Y 5 2000 -8.78
A Y 6 2000 -12.80
A Y 7 2000 -5.3
A Y 8 2000 -4.09
A Y 9 2000 -5.50
A Y 10 2000 -1.10
A Y 11 2000 0.65
A Y 12 2000 2.3
A Y 13 2000 3.5
A Y 14 2000 4.45
A Y 15 2000 8.32
A Y 16 2000 5.68
A Y 17 2000 4.45
A Y 18 2000 8.32
A Y 19 2000 5.48
A Y 20 2000 3.89
A Y 21 2000 5.17
A Y 22 2000 3.76
A Y 23 2000 12.3
A Y 24 2000 14.05
A Y 25 2000 17.20
A Y 26 2000 18.20
A Y 27 2000 16.82
A Y 28 2000 20.45
A Y 29 2000 17.77
A Y 30 2000 15.68
A Y 31 2000 16.05
A Y 32 2000 10.65
A Y 33 2000 11.65
A Y 34 2000 10.47
A Y 35 2000 12.20
A Y 36 2000 13.20
A Y 37 2000 8.32
A Y 38 2000 8.90
A Y 39 2000 11.82
A Y 40 2000 7.45
A Y 41 2000 7.77
A Y 42 2000 2.62
A Y 43 2000 5.89
A Y 44 2000 7.77
A Y 45 2000 5.62
A Y 46 2000 -4.45
A Y 47 2000 -3.78
A Y 48 2000 -1.90
A Y 49 2000 -2.78
A Y 50 2000 -4.09
A Y 51 2000 -2.43
A Y 52 2000 -6.78
;

proc sgplot data=temp; 
   where country='A';
   series x=date y=mean_temperature /group=muncipality;
   format date yymon.;
run;

 &lt;/PRE&gt;
&lt;P&gt;One of the reasons to use date values is that you can do a lot with those that character "week" or "year" will not without lots of work. Once you have a date variable you can use formats to allow getting yearly, monthly, quarterly and/or weekly summary values just by changing a format in a procedure like Proc Means, or counts from Proc Freq. The groups created by formats will be honored by reporting procedures like Report or Tabulate, analysis procedures and for many graphing tasks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS wants a single x axis variable. For date related values it is way better to actually use a SAS Date value so sort order is maintained.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is poor practice to provide example data with different variable names than the procedures using it. Your data step has Mean_temperature, your Sgplot code uses Mean_temp&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 14:29:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/841883#M332885</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-11-01T14:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/841884#M332886</link>
      <description>&lt;P&gt;Use the variable name WEEKNUMBER (that's what it is called in your data set) instead of WEEK. Also, when the data set is created, WEEKNUMBER and YEAR both should be numeric instead of character.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Nov 2022 14:39:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/841884#M332886</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-01T14:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842269#M333049</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ms_Raza_1-1667470550827.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76902iCDB702FCD2BE4D7D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ms_Raza_1-1667470550827.png" alt="Ms_Raza_1-1667470550827.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;I got this output after using your syntax. it seems like the syntax has put yearly graphs in one plot&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 10:16:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842269#M333049</guid>
      <dc:creator>Ms_Raza</dc:creator>
      <dc:date>2022-11-03T10:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842270#M333050</link>
      <description>&lt;P&gt;Since you have provided only one year of data, I can't test it on your real actual data. However, you can show me the ENTIRE log (all of it, every single character, no omissions) for the code that you ran. Please copy the log as text and paste it into the window that appears when you click on the &amp;lt;/&amp;gt; icon.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PaigeMiller_0-1663012019648.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75161i0E71B1489A6C9839/image-size/large?v=v2&amp;amp;px=999" role="button" title="PaigeMiller_0-1663012019648.png" alt="PaigeMiller_0-1663012019648.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something is wrong here, as your data has negative values, but your plot does not have negative values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, from now on, please don't provide plots where the axes are not labelled (as you did in your original post)&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 10:29:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842270#M333050</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-03T10:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842271#M333051</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;Thank a lot for replying and taking time to correct the syntax and for your suggestion!&lt;/P&gt;&lt;P&gt;Using date is definitely more useable than using weeks or year but unfortunately, I have need weekly averages for my exposure window. I have date in my original datafile. I agree with you on following proper practice to provide examples. Regarding the spelling of municipality. I don't why was it not obvious that it was a "typo".&lt;/P&gt;&lt;P&gt;When I ran your syntax on my data, using numerical date variable I got an error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ERROR: An exception has been encountered.&lt;BR /&gt;Please contact technical support and provide them with the following traceback information:&lt;/P&gt;&lt;P&gt;The SAS task name is [SGPLOT]&lt;BR /&gt;ERROR: Read Access Violation SGPLOT&lt;BR /&gt;Exception occurred at (AA93560E)&lt;BR /&gt;Task Traceback&lt;BR /&gt;Address Frame (DBGHELP API Version 4.0 rev 5)&lt;BR /&gt;00007FFFAA93560E 00000074D0DF74C0 sasstgr:tkvercn1+0x845CE&lt;BR /&gt;00007FFFAA9554C7 00000074D0DF7500 sasstgr:tkvercn1+0xA4487&lt;BR /&gt;00007FFFAA93F737 00000074D0DF7570 sasstgr:tkvercn1+0x8E6F7&lt;BR /&gt;00007FFFAFEE4467 00000074D0DF7578 sasods:tkvercn1+0x273427&lt;BR /&gt;00007FFFAFCC5198 00000074D0DF7840 sasods:tkvercn1+0x54158&lt;BR /&gt;00007FFFAFCC0F6E 00000074D0DF79D0 sasods:tkvercn1+0x4FF2E&lt;BR /&gt;00007FFFAB0C1A97 00000074D0DF79D8 sassgplo:tkvercn1+0xC0A57&lt;BR /&gt;00007FFFAB03B092 00000074D0DFF4E0 sassgplo:tkvercn1+0x3A052&lt;BR /&gt;00007FFFDB4AF5A8 00000074D0DFF4E8 sashost:Main+0x15268&lt;BR /&gt;00007FFFDB4B59CC 00000074D0DFF810 sashost:Main+0x1B68C&lt;BR /&gt;00007FF8449C7034 00000074D0DFF818 KERNEL32:BaseThreadInitThunk+0x14&lt;BR /&gt;00007FF8458C26A1 00000074D0DFF848 ntdll:RtlUserThreadStart+0x21&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 10:35:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842271#M333051</guid>
      <dc:creator>Ms_Raza</dc:creator>
      <dc:date>2022-11-03T10:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842275#M333052</link>
      <description>&lt;P&gt;Providing partial logs is almost always unhelpful. We need to see the CODE as it appears in the log and the messages, not the messages by themselves.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 10:52:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842275#M333052</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-03T10:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842279#M333053</link>
      <description>&lt;PRE&gt; data exposure;
5    set lib.weekly_avg_1999_2018;
6    run;

NOTE: There were 652292 observations read from the data set LIB.WEEKLY_AVG_1999_2018.
NOTE: The data set WORK.EXPOSURE has 652292 observations and 11 variables.
NOTE: DATA statement used (Total process time):
      real time           19.44 seconds
      cpu time            0.43 seconds


7
8    data exposure;
9     set exposure;
10       year_week=mdy(1,1,year)+(weeknumber-1)*7;
11       format year_week year4.;
12   run;

NOTE: There were 652292 observations read from the data set WORK.EXPOSURE.
NOTE: The data set WORK.EXPOSURE has 652292 observations and 12 variables.
NOTE: DATA statement used (Total process time):
      real time           0.13 seconds
      cpu time            0.14 seconds


13   ods graphics on / obsmax=302200;
14   proc sgplot data=exposure; where country='A';
15       series x=year_week y= mean_temp;
16   run;

NOTE: PROCEDURE SGPLOT used (Total process time):
      real time           1.38 seconds
      cpu time            0.37 seconds

NOTE: Marker and line antialiasing has been disabled for at least one plot because the threshold has
      been reached. You can set ANTIALIASMAX=302200 in the ODS GRAPHICS statement to enable
      antialiasing for all plots.
NOTE: There were 302180 observations read from the data set WORK.EXPOSURE.
      WHERE country='A';

&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ms_Raza_0-1667472966710.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76904iD6E1214F1A2641BC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ms_Raza_0-1667472966710.png" alt="Ms_Raza_0-1667472966710.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;previous graph was on different exposure using the same syntax. This one is now on mean temperature.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 10:57:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842279#M333053</guid>
      <dc:creator>Ms_Raza</dc:creator>
      <dc:date>2022-11-03T10:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842280#M333054</link>
      <description>&lt;PRE&gt;NOTE: There were 302180 observations read from the data set WORK.EXPOSURE.
      WHERE country='A';&lt;/PRE&gt;
&lt;P&gt;If there are 21 years, and 52 weeks in a year, then I would expect around 1092 records for a country. But obviously, you have a whole lot more records, and that is causing the plot to appear the way it does, looking like there are many lines going left to right when you were expecting one line going across the plot left to right.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you need to investigate why country='A' has 302180 records instead of around 1092, which is what I would expect.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 11:19:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842280#M333054</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-03T11:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842281#M333055</link>
      <description>&lt;P&gt;That is because country has municipalities, and each municipality has data for each year. So say for example if the country has 300 municipalities, then 300 multiply by 52 or 53 weeks multiply by total number of years=total number of row for that country.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 11:31:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842281#M333055</guid>
      <dc:creator>Ms_Raza</dc:creator>
      <dc:date>2022-11-03T11:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842282#M333056</link>
      <description>&lt;P&gt;So do you want to average across municipalities to obtain 21 yrs times 52 weeks? Or do you want a plot for each municipality? Or something else?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 11:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842282#M333056</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-03T11:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842302#M333066</link>
      <description>&lt;P&gt;OK, now I understand the problem. I have around 300 municipalities in my dataset and I was trying to graph data for all the municipalities with so many repeated values for weeks of the same years. Now when I graphed the values for one municipality using your syntax I got the correct graph.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ms_Raza_0-1667479558724.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76909i19B3DD2E6A251ACB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ms_Raza_0-1667479558724.png" alt="Ms_Raza_0-1667479558724.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So, to produce the same for the country, values should be averaged for all the municipalities and then I get country level data to graph.&lt;/P&gt;&lt;P&gt;Thanks a lot for your input, it directed me to the right thinking. It is so basic; I don't understand why I missed it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 12:51:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842302#M333066</guid>
      <dc:creator>Ms_Raza</dc:creator>
      <dc:date>2022-11-03T12:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842303#M333067</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/298826"&gt;@Ms_Raza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;OK, now I understand the problem. I have around 300 municipalities in my dataset and I was trying to graph data for all the municipalities with so many repeated values for weeks of the same years. Now when I graphed the values for one municipality using your syntax I got the correct graph.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ms_Raza_0-1667479558724.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76909i19B3DD2E6A251ACB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ms_Raza_0-1667479558724.png" alt="Ms_Raza_0-1667479558724.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;So, to produce the same for the country, values should be averaged for all the municipalities and then I get country level data to graph.&lt;/P&gt;
&lt;P&gt;Thanks a lot for your input, it directed me to the right thinking. It is so basic; I don't understand why I missed it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Glad that it helped. One minor issue ... you said: "So, to produce the same for the country, values should be averaged for all the municipalities" ... I would say you can (not "should") work from averages, but you can also work from medians, or 75-percentile, or any other statistic that makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I would change the labels on the axes and add a title which municipality this is (doesn't have to go in the title, but that seems to be the best place for it).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=exposure; where country='A';
    series x=year_week y=mean_temp;
    title "Municipality: Boston";
    xaxis label="Year";
    yaxis label="Mean Temperature °C";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can also use the BY statement to generate all plots for all municipalities and all countries if you want (but if you have 300 municipalities in one country, that may be too much to look at).&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 13:05:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842303#M333067</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-03T13:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842305#M333069</link>
      <description>&lt;P&gt;Great, I will add correct labels and titles to the graph.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 13:09:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842305#M333069</guid>
      <dc:creator>Ms_Raza</dc:creator>
      <dc:date>2022-11-03T13:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: SGPlot temperature trend</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842322#M333079</link>
      <description>&lt;P&gt;Without YOUR code and YOUR data that sort of error really can't be addressed. The most common causes for the exception errors are usually pretty odd combinations of syntax and data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I asked about the spelling just in case. Nothing like providing data with the spelling of the variable one way and differently in another.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/298826"&gt;@Ms_Raza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;Thank a lot for replying and taking time to correct the syntax and for your suggestion!&lt;/P&gt;
&lt;P&gt;Using date is definitely more useable than using weeks or year but unfortunately, I have need weekly averages for my exposure window. I have date in my original datafile. I agree with you on following proper practice to provide examples. Regarding the spelling of municipality. I don't why was it not obvious that it was a "typo".&lt;/P&gt;
&lt;P&gt;When I ran your syntax on my data, using numerical date variable I got an error&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ERROR: An exception has been encountered.&lt;BR /&gt;Please contact technical support and provide them with the following traceback information:&lt;/P&gt;
&lt;P&gt;The SAS task name is [SGPLOT]&lt;BR /&gt;ERROR: Read Access Violation SGPLOT&lt;BR /&gt;Exception occurred at (AA93560E)&lt;BR /&gt;Task Traceback&lt;BR /&gt;Address Frame (DBGHELP API Version 4.0 rev 5)&lt;BR /&gt;00007FFFAA93560E 00000074D0DF74C0 sasstgr:tkvercn1+0x845CE&lt;BR /&gt;00007FFFAA9554C7 00000074D0DF7500 sasstgr:tkvercn1+0xA4487&lt;BR /&gt;00007FFFAA93F737 00000074D0DF7570 sasstgr:tkvercn1+0x8E6F7&lt;BR /&gt;00007FFFAFEE4467 00000074D0DF7578 sasods:tkvercn1+0x273427&lt;BR /&gt;00007FFFAFCC5198 00000074D0DF7840 sasods:tkvercn1+0x54158&lt;BR /&gt;00007FFFAFCC0F6E 00000074D0DF79D0 sasods:tkvercn1+0x4FF2E&lt;BR /&gt;00007FFFAB0C1A97 00000074D0DF79D8 sassgplo:tkvercn1+0xC0A57&lt;BR /&gt;00007FFFAB03B092 00000074D0DFF4E0 sassgplo:tkvercn1+0x3A052&lt;BR /&gt;00007FFFDB4AF5A8 00000074D0DFF4E8 sashost:Main+0x15268&lt;BR /&gt;00007FFFDB4B59CC 00000074D0DFF810 sashost:Main+0x1B68C&lt;BR /&gt;00007FF8449C7034 00000074D0DFF818 KERNEL32:BaseThreadInitThunk+0x14&lt;BR /&gt;00007FF8458C26A1 00000074D0DFF848 ntdll:RtlUserThreadStart+0x21&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 14:09:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SGPlot-temperature-trend/m-p/842322#M333079</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-11-03T14:09:26Z</dc:date>
    </item>
  </channel>
</rss>

