BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Zachary
Obsidian | Level 7

Please view the following code:

proc corr data = L_P1.UWR_10YrData plots(maxpoints = none) = matrix(nvar = all);

  var D_DELQ_DEFU_INDN D_DELQ_NATL_PCTL D_DELQ_SCR D_FAIL_DEFU_INDN D_FAIL_NATL_PCTL D_FAIL_SCR;

with BLEND_GROSS_LOAD;

run;

How may I simplify my code so that it does not request a plot?

While on this topic, is there also a way to request all _numeric_ vars that begin with a prefix of D_?

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

Don't you mean FROM DICTIONARY.COLUMNS not FROM L_P1.UWR_10YRDATA

View solution in original post

11 REPLIES 11
stat_sas
Ammonite | Level 13

proc corr data = L_P1.UWR_10YrData plots(maxpoints = none) = matrix(nvar = all);

  var D_:;

with BLEND_GROSS_LOAD;

run;

PGStats
Opal | Level 21

First question: PLOTS=NONE;

Second question: if all variables beginning with prefix D_ are numeric, use VAR D_:;

PG

PG
Ksharp
Super User

Not sure if it could work.

ods _all_ close;

ods graphics off;

proc corr

art297
Opal | Level 21

You haven't marked your question as correct yet, thus I presume you either forgot or are waiting for more possibilities. Here is one more possibility:

proc sql noprint;

  select name

    into :vars separated by ' '

      from sashelp.vcolumn

        where libname='L_P1' and

              memname='UWR_10YRDATA' and

              upcase(name) ne 'BLEND_GROSS_LOAD' and

              type='num'

  ;

quit;

proc corr data = L_P1.UWR_10YrData;

  var &vars.;

  with BLEND_GROSS_LOAD;

run;

Zachary
Obsidian | Level 7

Capture.JPG

I am intrigued by this possibility - and I apologize for taking so long to respond.

First, the line from sashelp.vcolumn. It seems be a little redundant with the where libname... stuff that follows identifies the library and name of the data file. It seems to be redundant with the where statement that precedes it.

So I changed the line saying from sashelp.vocolumn and I receive multiple errors:

I am pretty sure that is it is pretty simple. And again I am very intrigued by how this may keep things simple. My entire block of code follows:

libname L_P1 "\\SAS01\sasusers\Shared\PredictiveModeling";

proc sql noprint;

  select name

    into :vars separated by ' '

      from L_P1.UWR_10YrData

        where libname='L_P1' and

              memname='UWR_10YrData' and

              upcase(name) ne 'BLEND_GROSS_LOAD' and

              type='num';

quit;

proc corr data = L_P1.UWR_10YrData;

  var &vars.;

  with BLEND_GROSS_LOAD;

run;

libname L_P1 clear;

Thank you.

art297
Opal | Level 21

The libname and filename (memname) have to be in upper case. Just change the 'r' to be an 'R'

Zachary
Obsidian | Level 7

Still not working:

proc sql noprint;

  select name

    into :vars separated by ' '

      from L_P1.UWR_10YRDATA

        where libname='L_P1' and

              upcase(memname)='UWR_10YRDATA' and

              upcase(name) ne 'BLEND_GROSS_LOAD' and

              type='num';

quit;

proc corr data = L_P1.UWR_10YRDATA;

  var &vars.;

  with BLEND_GROSS_LOAD;

run;

I added an upcase function to memname to get it to work.

art297
Opal | Level 21

Can you post your log so we can see what isn't working?

Zachary
Obsidian | Level 7

Sure. The actual log follows. Thanks.

Capture.JPG

1                                                          The SAS System                             10:27 Friday, January 23, 2015

1          %_eg_hidenotesandsource;
5          %_eg_hidenotesandsource;
28        
29         libname L_P1 "\\SAS01\sasusers\Shared\PredictiveModeling";
NOTE: Libref L_P1 was successfully assigned as follows:
      Engine:        V9
      Physical Name: \\SAS01\sasusers\Shared\PredictiveModeling
30        
31         proc sql noprint;
32           select name
33             into :vars separated by ' '
34               from L_P1.UWR_10YRDATA
35                 where libname='L_P1' and
36                       upcase(memname)='UWR_10YRDATA' and
37                       upcase(name) ne 'BLEND_GROSS_LOAD' and
38                       type='num';
ERROR: The following columns were not found in the contributing tables: libname, memname, name, type.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
39         quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
     
40        


41         proc corr data = L_P1.UWR_10YRDATA;
42           var &vars.;
                 _
                 22
                 200
WARNING: Apparent symbolic reference VARS not resolved.
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.
43           with BLEND_GROSS_LOAD;
44         run;

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE CORR used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
     
45        
46         libname L_P1 clear;
NOTE: Libref L_P1 has been deassigned.
47        
48        
49         %_eg_hidenotesandsource;
61        
62        
63         %_eg_hidenotesandsource;
66        







data_null__
Jade | Level 19

Don't you mean FROM DICTIONARY.COLUMNS not FROM L_P1.UWR_10YRDATA

Zachary
Obsidian | Level 7

Works perfectly now. Thank you very much.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 11 replies
  • 3580 views
  • 3 likes
  • 6 in conversation