Anyone know what's wrong with my code that I'm getting this error message in my log?:
15 PCE0 = PCE/6712.166667;
----
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
116 RGAS = Price/PCE0;
----
180
So I have to find the real price of gas and I found the average price of my deflator in my excel file of the year 2000 which is my base year which turned out to be 6712.166667. I was given this code to use to create my new variable of the real price of gas but it's not working. I have never done this before so I'm not sure what to do. Here is my code getting the error message:
PCE0 = PCE/6712.166667;
RGAS = Price/PCE0;
This is my full code:
ODS LISTING;
libname session1 "x";
PROC IMPORT OUT= WORK.one
DATAFILE="x"
DBMS=csv REPLACE;
RUN;
proc print data= WORK.one;
run;
proc contents;
run;
PCE0 = PCE/6712.166667;
RGAS = Price/PCE0;
I hid my pathway.
Maxims of Maximally Efficient SAS Programmers
https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers...
How to convert datasets to data steps
https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...
The macro for direct download
https://gist.githubusercontent.com/statgeek/bcc55940dd825a13b9c8ca40a904cba9/raw/865d2cf18f5150b8e88...
How to post code
https://communities.sas.com/t5/help/faqpage/faq-category-id/posting#posting
You can't access variables like that. To create a new variable it needs to be within a data step.
You're essentially creating new variables.
Here's a video tutorial that covers the topic:
And yes, you need to provide enough code and the log for us to help you. Posting partial code hides the issues, especially when it's something as big as not using a data step.
@khalillx wrote:
Anyone know what's wrong with my code that I'm getting this error message in my log?:
15 PCE0 = PCE/6712.166667;
----
180ERROR 180-322: Statement is not valid or it is used out of proper order.
116 RGAS = Price/PCE0;
----
180
So I have to find the real price of gas and I found the average price of my deflator in my excel file of the year 2000 which is my base year which turned out to be 6712.166667. I was given this code to use to create my new variable of the real price of gas but it's not working. I have never done this before so I'm not sure what to do. Here is my code getting the error message:
PCE0 = PCE/6712.166667;
RGAS = Price/PCE0;
This is my full code:
ODS LISTING;
libname session1 "x";PROC IMPORT OUT= WORK.one
DATAFILE="x"
DBMS=csv REPLACE;
RUN;
proc print data= WORK.one;
run;proc contents;
run;PCE0 = PCE/6712.166667;
RGAS = Price/PCE0;
I hid my pathway.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.