<?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 Can't perform mathematical operations using SASHELP data in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600150#M8203</link>
    <description>&lt;P&gt;I am having trouble performing simple mathematical operations with SASHELP.class data. I am trying to subtract one pound from all of the classmates' weights, but an error message comes up reading "&lt;SPAN&gt;ERROR: User does not have appropriate authorization level for library SASHELP." Below is the code that I am currently using. I have also transposed the data, so I would like the results to be transposed as well.&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;PROC EXPORT data=sashelp.class&lt;BR /&gt;outfile=_dataout&lt;BR /&gt;dbms=dlm replace; run;&lt;/P&gt;&lt;P&gt;PROC CONTENTS data=sashelp.class; RUN;&lt;/P&gt;&lt;P&gt;PROC TRANSPOSE data=sashelp.class&lt;BR /&gt;OUT=class_transposed; RUN;&lt;BR /&gt;&lt;BR /&gt;PROC REPORT data=class_transposed; RUN;&lt;/P&gt;&lt;P&gt;DATA sashelp.class;&lt;BR /&gt;set class_transposed;&lt;BR /&gt;Weight = Weight - 1;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried to perform the operation of subtracting one pound from all the weights in a data step with the variables "_NAME_" and "Weight" using IF THEN statements, but that didn't work either.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know how I can use data from sashelp and perform simple arithmetic operations without having the "authorization" error pop up? Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Oct 2019 19:03:37 GMT</pubDate>
    <dc:creator>tpage</dc:creator>
    <dc:date>2019-10-29T19:03:37Z</dc:date>
    <item>
      <title>Can't perform mathematical operations using SASHELP data</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600150#M8203</link>
      <description>&lt;P&gt;I am having trouble performing simple mathematical operations with SASHELP.class data. I am trying to subtract one pound from all of the classmates' weights, but an error message comes up reading "&lt;SPAN&gt;ERROR: User does not have appropriate authorization level for library SASHELP." Below is the code that I am currently using. I have also transposed the data, so I would like the results to be transposed as well.&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;PROC EXPORT data=sashelp.class&lt;BR /&gt;outfile=_dataout&lt;BR /&gt;dbms=dlm replace; run;&lt;/P&gt;&lt;P&gt;PROC CONTENTS data=sashelp.class; RUN;&lt;/P&gt;&lt;P&gt;PROC TRANSPOSE data=sashelp.class&lt;BR /&gt;OUT=class_transposed; RUN;&lt;BR /&gt;&lt;BR /&gt;PROC REPORT data=class_transposed; RUN;&lt;/P&gt;&lt;P&gt;DATA sashelp.class;&lt;BR /&gt;set class_transposed;&lt;BR /&gt;Weight = Weight - 1;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried to perform the operation of subtracting one pound from all the weights in a data step with the variables "_NAME_" and "Weight" using IF THEN statements, but that didn't work either.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know how I can use data from sashelp and perform simple arithmetic operations without having the "authorization" error pop up? Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 19:03:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600150#M8203</guid>
      <dc:creator>tpage</dc:creator>
      <dc:date>2019-10-29T19:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Can't perform mathematical operations using SASHELP data</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600153#M8204</link>
      <description>&lt;P&gt;Can you please provide some comments for what you think the statements you posted are doing? That way we can help you understand better.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to do calculations using a variable you need use a variable that exists. Otherwise SAS will just create a new variable and set it to missing. So all of your calculations will be done on those missing values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also you cannot overwrite the SASHELP datasets. They are READONLY.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set sashelp.class;
  Weight = Weight - 1;
run;

 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 19:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600153#M8204</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-29T19:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Can't perform mathematical operations using SASHELP data</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600198#M8208</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290322"&gt;@tpage&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I am having trouble performing simple mathematical operations with SASHELP.class data. I am trying to subtract one pound from all of the classmates' weights, but an error message comes up reading "&lt;SPAN&gt;ERROR: User does not have appropriate authorization level for library SASHELP." Below is the code that I am currently using. I have also transposed the data, so I would like the results to be transposed as well.&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;PROC EXPORT data=sashelp.class&lt;BR /&gt;outfile=_dataout&lt;BR /&gt;dbms=dlm replace; run;&lt;/P&gt;
&lt;P&gt;PROC CONTENTS data=sashelp.class; RUN;&lt;/P&gt;
&lt;P&gt;PROC TRANSPOSE data=sashelp.class&lt;BR /&gt;OUT=class_transposed; RUN;&lt;BR /&gt;&lt;BR /&gt;PROC REPORT data=class_transposed; RUN;&lt;/P&gt;
&lt;P&gt;DATA sashelp.class;&lt;BR /&gt;set class_transposed;&lt;BR /&gt;Weight = Weight - 1;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also tried to perform the operation of subtracting one pound from all the weights in a data step with the variables "_NAME_" and "Weight" using IF THEN statements, but that didn't work either.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone know how I can use data from sashelp and perform simple arithmetic operations without having the "authorization" error pop up? Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can't (it's not allowed) overwrite SASHELP.CLASS or any SAS data set in SASHELP. Thus, your last data step ought to be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA class;
set class_transposed;
Weight = Weight - 1;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This creates a temporary (WORK) data set, which is allowed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, the rest of the PROCs that you use don't seem to have anything to do with the stated goal of subtracting one from weight. Your entire program could be&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
    set sashelp.class;
    weight=weight-1;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 22:29:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600198#M8208</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-29T22:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: Can't perform mathematical operations using SASHELP data</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600209#M8209</link>
      <description>&lt;P&gt;Is there any way I can do the same thing to the transposed data, using the _NAME_ and WEIGHT variables?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 23:13:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600209#M8209</guid>
      <dc:creator>tpage</dc:creator>
      <dc:date>2019-10-29T23:13:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can't perform mathematical operations using SASHELP data</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600210#M8210</link>
      <description>&lt;P&gt;Do you know how I can perform the same arithmetic directly to the transposed data using the _NAME_ and Weight variables?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2019 23:16:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600210#M8210</guid>
      <dc:creator>tpage</dc:creator>
      <dc:date>2019-10-29T23:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can't perform mathematical operations using SASHELP data</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600212#M8211</link>
      <description>&lt;P&gt;It will be much header with the horizontal structure you will get from proc transpose.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you run your transpose step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC TRANSPOSE
  data=sashelp.class
  OUT=class_transposed
; 
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You will have three observations that variables _NAME_ and COL1 to COL19 since there were 3 numeric variables and 19 observations in the original dataset.&lt;/P&gt;
&lt;P&gt;So to subtract one from "wieght" you will need to do 19 subtractions. One for COL1 and one for COL2 etc.&lt;/P&gt;
&lt;P&gt;You can use an ARRAY to make that easier to type.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  set class_transposed;
  array values col: ;
  if upcase(_name_)='WEIGHT' then do over values;
    values=values-1;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Oct 2019 23:30:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600212#M8211</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-29T23:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can't perform mathematical operations using SASHELP data</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600355#M8212</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/290322"&gt;@tpage&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Do you know how I can perform the same arithmetic directly to the transposed data using the _NAME_ and Weight variables?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sure, but then the programming is much more difficult. So again I recommend that you don't bother with PROC TRANSPOSE.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2019 12:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Can-t-perform-mathematical-operations-using-SASHELP-data/m-p/600355#M8212</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-30T12:25:57Z</dc:date>
    </item>
  </channel>
</rss>

