Data visualization with SAS programming

Please explain the error in the code

Reply
Frequent Contributor
Posts: 91

Please explain the error in the code

Hi can someone please help me correct the error Im getting in the following code. Data set attached. thanks.

I AM USING SAS 9.0

Attachment
Grand Advisor
Posts: 16,348

Re: Please explain the error in the code

Whats the error? What are you trying to do that isn't working?

Frequent Contributor
Posts: 91

Re: Please explain the error in the code

sorry forgot to attach the code:

data test;

    infile "F:\data\wvar.csv"  DSD MISSOVER;

      input  residuals;

run;

data test1;

set test;

sig = 0;

_n_ =1;

do

call symput('res',residuals);

y = symput('res');

_n_= _n_ +1;

sig2 = 0.0000624 +  0.1438*y*y +  0.634*sig*sig;

sig = sqrt(sig2);

end;

PROC EXPORT DATA=test1

            OUTFILE="F:\data\residuals.csv"

            DBMS=csv REPLACE;

RUN;

run;

SAS Super FREQ
Posts: 8,645

Re: Please explain the error in the code

Hi:

  Can you explain what portion of your code is related to SAS/GRAPH or ODS GRAPHICS? This code is probably better posted in either the SAS Procedures forum or the Data Step and Macro Language forum. Since I do not see ANY graph procedures in your code, I don't understand why your posting is here.

  Also, many folks do not have SAS 9.0 to test with. For help with older versions of SAS, you may want to work with SAS Tech Support. You also may want to look at the syntax for CALL SYMPUT (which is something that the folks in the Macro forum could help with). I believe you have coded at least one statement with SYMPUT incorrectly. Also, you are using the DO incorrectly and should be getting error messages in your log. What are those error messages?

  I would suggest that you collect this information and repost your question in the correct forum and not in the graphics forum.

Thanks!

cynthia

Super User
Super User
Posts: 5,971

Re: Please explain the error in the code

You need to explain your algorithm.  Basically you should get rid of any attempt to loop over the data. The basic data step will take care of that for you.  You should RETAIN the values that you want to carry forward (retain) to the next observation.

Your CSV file says the name of the variable is WVAR, so I have modified the code to use that name instead of RESIDUALS.  (not sure why it would be plural anyway).

You do not define Y in your program.  I have assumed it is yet another name for the data in the CSV file.

Perhaps you want something like this?

data test;

    infile "F:\data\wvar.csv"  DSD MISSOVER firstobs=2;

    input  wvar ;

    retain sig 0;

    sig2 = 0.0000624 +  0.1438*wvar*wvar +  0.634*sig*sig;

     output;

    sig = sqrt(sig2);

run;

Frequent Contributor
Posts: 91

Re: Please explain the error in the code

Thank you very much. This helps a lot

Post a Question
Discussion Stats
  • 5 replies
  • 196 views
  • 1 like
  • 4 in conversation