Programming the statistical procedures from SAS

i have some codes for F test, but many mistakes

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

i have some codes for F test, but many mistakes

please tell me what kind of mistake in the following codes.

1849  ********* Calculate GRS F-Statistics;

1850

1851

1852  proc iml;

NOTE: IML Ready

1853

1854  use fcov;

1855  read b  into O;

           -

           22

           76

ERROR 22-322: Syntax error, expecting one of the following: INTO, POINT, VAR, VARIABLES.

ERROR 76-322: Syntax error, statement will be ignored.

1856  print O;

ERROR: Matrix O has not been set to a value.

statement : PRINT at line 1856 column 1

1857

1858  invO=inv(O);

ERROR: (execution) Matrix has not been set to a value.

operation : INV at line 1858 column 9

operands  : O

O      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1858 column 1

1858!              ***Inverse Omega;

1859  print invO;

ERROR: Matrix invO has not been set to a value.

statement : PRINT at line 1859 column 1

1860

1861  use fmean;

1862  read b into M;

           -

           22

           76

ERROR 22-322: Syntax error, expecting one of the following: INTO, POINT, VAR, VARIABLES.

ERROR 76-322: Syntax error, statement will be ignored.

1863  print M;

ERROR: Matrix M has not been set to a value.

statement : PRINT at line 1863 column 1

1864

1865  tM=M`;

ERROR: (execution) Matrix has not been set to a value.

operation : ` at line 1865 column 5

operands  : M

M      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1865 column 1

1865!        ***Transpose E(f);

1866  print tM;

ERROR: Matrix tM has not been set to a value.

statement : PRINT at line 1866 column 1

1867

1868  tM_invO=tM*invO;

ERROR: (execution) Matrix has not been set to a value.

operation : * at line 1868 column 11

operands  : tM, invO

tM      0 row       0 col     (type ?, size 0)

invO      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1868 column 1

1869  print tM_invO;

ERROR: Matrix tM_invO has not been set to a value.

statement : PRINT at line 1869 column 1

1870

1871  tM2_invO=tM_invO*M;

ERROR: (execution) Matrix has not been set to a value.

operation : * at line 1871 column 17

operands  : tM_invO, M

tM_invO      0 row       0 col     (type ?, size 0)

M      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1871 column 1

1872  print tM2_invO;

ERROR: Matrix tM2_invO has not been set to a value.

statement : PRINT at line 1872 column 1

1873

1874  Z=1+tM2_invO;

ERROR: (execution) Matrix has not been set to a value.

operation : + at line 1874 column 4

operands  : *LIT1001, tM2_invO

*LIT1001      1 row       1 col     (numeric)

         1

tM2_invO      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1874 column 1

1875  invZ=inv(Z);

ERROR: (execution) Matrix has not been set to a value.

operation : INV at line 1875 column 9

operands  : Z

Z      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1875 column 1

1876

1877  use rinvcov;

1878  read b var _num_ into invS;

           -

           22

           76

ERROR 22-322: Syntax error, expecting one of the following: INTO, POINT, VAR, VARIABLES.

ERROR 76-322: Syntax error, statement will be ignored.

1879  print invS;

ERROR: Matrix invS has not been set to a value.

statement : PRINT at line 1879 column 1

1880

1881  use parms;

1882  read b var _num_ into A;

           -

           22

           76

ERROR 22-322: Syntax error, expecting one of the following: INTO, POINT, VAR, VARIABLES.

ERROR 76-322: Syntax error, statement will be ignored.

1883  print A;

ERROR: Matrix A has not been set to a value.

statement : PRINT at line 1883 column 1

1884

1885  tA=A`;

ERROR: (execution) Matrix has not been set to a value.

operation : ` at line 1885 column 5

operands  : A

A      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1885 column 1

1886  print tA;

ERROR: Matrix tA has not been set to a value.

statement : PRINT at line 1886 column 1

1887

1888  tA_invS=tA*invS;

ERROR: (execution) Matrix has not been set to a value.

operation : * at line 1888 column 11

operands  : tA, invS

tA      0 row       0 col     (type ?, size 0)

invS      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1888 column 1

1889  print tA_invS;

ERROR: Matrix tA_invS has not been set to a value.

statement : PRINT at line 1889 column 1

1890

1891  tA2_invS=tA_invS*A;

ERROR: (execution) Matrix has not been set to a value.

operation : * at line 1891 column 17

operands  : tA_invS, A

tA_invS      0 row       0 col     (type ?, size 0)

A      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1891 column 1

1892  print tA2_invS;

ERROR: Matrix tA2_invS has not been set to a value.

statement : PRINT at line 1892 column 1

1893

1894  X=(T-N-K)/N;

ERROR: (execution) Matrix has not been set to a value.

operation : - at line 1894 column 5

operands  : T, N

T      0 row       0 col     (type ?, size 0)

N      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1894 column 1

1894!              ***Need to plug in figure manually;

1895  F1=X*invZ*tA2_invS;

ERROR: (execution) Matrix has not been set to a value.

operation : * at line 1895 column 5

operands  : X, invZ

X      0 row       0 col     (type ?, size 0)

invZ      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1895 column 1

1896  print F1;

ERROR: Matrix F1 has not been set to a value.

statement : PRINT at line 1896 column 1

1897  run;

NOTE: Module MAIN is undefined in IML; cannot be RUN.

1849  ********* Calculate GRS F-Statistics;

1850

1851

1852  proc iml;

NOTE: IML Ready

1853

1854  use fcov;

1855  read b  into O;

           -

           22

           76

ERROR 22-322: Syntax error, expecting one of the following: INTO, POINT, VAR, VARIABLES.

ERROR 76-322: Syntax error, statement will be ignored.

1856  print O;

ERROR: Matrix O has not been set to a value.

statement : PRINT at line 1856 column 1

1857

1858  invO=inv(O);

ERROR: (execution) Matrix has not been set to a value.

operation : INV at line 1858 column 9

operands  : O

O      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1858 column 1

1858!              ***Inverse Omega;

1859  print invO;

ERROR: Matrix invO has not been set to a value.

statement : PRINT at line 1859 column 1

1860

1861  use fmean;

1862  read b into M;

           -

           22

           76

ERROR 22-322: Syntax error, expecting one of the following: INTO, POINT, VAR, VARIABLES.

ERROR 76-322: Syntax error, statement will be ignored.

1863  print M;

ERROR: Matrix M has not been set to a value.

statement : PRINT at line 1863 column 1

1864

1865  tM=M`;

ERROR: (execution) Matrix has not been set to a value.

operation : ` at line 1865 column 5

operands  : M

M      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1865 column 1

1865!        ***Transpose E(f);

1866  print tM;

ERROR: Matrix tM has not been set to a value.

statement : PRINT at line 1866 column 1

1867

1868  tM_invO=tM*invO;

ERROR: (execution) Matrix has not been set to a value.

operation : * at line 1868 column 11

operands  : tM, invO

tM      0 row       0 col     (type ?, size 0)

invO      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1868 column 1

1869  print tM_invO;

ERROR: Matrix tM_invO has not been set to a value.

statement : PRINT at line 1869 column 1

1870

1871  tM2_invO=tM_invO*M;

ERROR: (execution) Matrix has not been set to a value.

operation : * at line 1871 column 17

operands  : tM_invO, M

tM_invO      0 row       0 col     (type ?, size 0)

M      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1871 column 1

1872  print tM2_invO;

ERROR: Matrix tM2_invO has not been set to a value.

statement : PRINT at line 1872 column 1

1873

1874  Z=1+tM2_invO;

ERROR: (execution) Matrix has not been set to a value.

operation : + at line 1874 column 4

operands  : *LIT1001, tM2_invO

*LIT1001      1 row       1 col     (numeric)

         1

tM2_invO      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1874 column 1

1875  invZ=inv(Z);

ERROR: (execution) Matrix has not been set to a value.

operation : INV at line 1875 column 9

operands  : Z

Z      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1875 column 1

1876

1877  use rinvcov;

1878  read b var _num_ into invS;

           -

           22

           76

ERROR 22-322: Syntax error, expecting one of the following: INTO, POINT, VAR, VARIABLES.

ERROR 76-322: Syntax error, statement will be ignored.

1879  print invS;

ERROR: Matrix invS has not been set to a value.

statement : PRINT at line 1879 column 1

1880

1881  use parms;

1882  read b var _num_ into A;

           -

           22

           76

ERROR 22-322: Syntax error, expecting one of the following: INTO, POINT, VAR, VARIABLES.

ERROR 76-322: Syntax error, statement will be ignored.

1883  print A;

ERROR: Matrix A has not been set to a value.

statement : PRINT at line 1883 column 1

1884

1885  tA=A`;

ERROR: (execution) Matrix has not been set to a value.

operation : ` at line 1885 column 5

operands  : A

A      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1885 column 1

1886  print tA;

ERROR: Matrix tA has not been set to a value.

statement : PRINT at line 1886 column 1

1887

1888  tA_invS=tA*invS;

ERROR: (execution) Matrix has not been set to a value.

operation : * at line 1888 column 11

operands  : tA, invS

tA      0 row       0 col     (type ?, size 0)

invS      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1888 column 1

1889  print tA_invS;

ERROR: Matrix tA_invS has not been set to a value.

statement : PRINT at line 1889 column 1

1890

1891  tA2_invS=tA_invS*A;

ERROR: (execution) Matrix has not been set to a value.

operation : * at line 1891 column 17

operands  : tA_invS, A

tA_invS      0 row       0 col     (type ?, size 0)

A      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1891 column 1

1892  print tA2_invS;

ERROR: Matrix tA2_invS has not been set to a value.

statement : PRINT at line 1892 column 1

1893

1894  X=(T-N-K)/N;

ERROR: (execution) Matrix has not been set to a value.

operation : - at line 1894 column 5

operands  : T, N

T      0 row       0 col     (type ?, size 0)

N      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1894 column 1

1894!              ***Need to plug in figure manually;

1895  F1=X*invZ*tA2_invS;

ERROR: (execution) Matrix has not been set to a value.

operation : * at line 1895 column 5

operands  : X, invZ

X      0 row       0 col     (type ?, size 0)

invZ      0 row       0 col     (type ?, size 0)

statement : ASSIGN at line 1895 column 1

1896  print F1;

ERROR: Matrix F1 has not been set to a value.

statement : PRINT at line 1896 column 1

1897  run;

NOTE: Module MAIN is undefined in IML; cannot be RUN.


Accepted Solutions
Solution
‎04-24-2013 10:02 AM
SAS Super FREQ
Posts: 3,306

Re: i have some codes for F test, but many mistakes

To read data from a SAS data set into a SAS/IML matrix, read this article: Reading SAS data sets - The DO Loop

I don't know what you intend by

"read b into O"

Since you later try to invert O, use one of these alternatives:

read all var _NUM_ into O;

or

read all var {var1 var v2 var4} into O;

where VAR1-VAR4 are the names of the variables in the data set.

Two other comments:

1) Most programmers avoid using O as a variable because it looks too similar to 0.

2) The SAS/IML language is an interactive language and doesn't use the RUN statement. Read the article Never End PROC IML with a RUN Statement - The DO Loop

View solution in original post


All Replies
Solution
‎04-24-2013 10:02 AM
SAS Super FREQ
Posts: 3,306

Re: i have some codes for F test, but many mistakes

To read data from a SAS data set into a SAS/IML matrix, read this article: Reading SAS data sets - The DO Loop

I don't know what you intend by

"read b into O"

Since you later try to invert O, use one of these alternatives:

read all var _NUM_ into O;

or

read all var {var1 var v2 var4} into O;

where VAR1-VAR4 are the names of the variables in the data set.

Two other comments:

1) Most programmers avoid using O as a variable because it looks too similar to 0.

2) The SAS/IML language is an interactive language and doesn't use the RUN statement. Read the article Never End PROC IML with a RUN Statement - The DO Loop

SAS Super FREQ
Posts: 3,306

Re: i have some codes for F test, but many mistakes

Oh, and if you follow up with additional issues, please attach the code and only the FIRST error message.  You have to fix errors in order:  the second error usually occurs because the first error leaves some variable unassigned.

Occasional Contributor
Posts: 15

Re: i have some codes for F test, but many mistakes

the ''all'' is a keyword? why many people use ''all'' in there programs?

Occasional Contributor
Posts: 15

Re: i have some codes for F test, but many mistakes

just like this one '' read all var _NUM_ into O;''

SAS Super FREQ
Posts: 3,306

Re: i have some codes for F test, but many mistakes

Yes, ALL is a keyword. This is mentioned in the fourth paragraph of the article that I linked to.

The section of the doc that relates to reading data is here: SAS/IML(R) 12.1 User's Guide

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 203 views
  • 0 likes
  • 2 in conversation