Help using Base SAS procedures

Invalid numeric data error

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

Invalid numeric data error

I do not understand why I am getting this error:

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

_N_=10122

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Missing values were generated as a result of performing an operation on missing values.

.....When I enter the following code:

54        if rs9939609 = 44 then rs9939609_new = "TT";
55        if rs9939609 = 14 then rs9939609_new = "AT";
56        if rs9939609 = 11 then rs9939609_new = "AA";

Thanks,

Gita


Accepted Solutions
Solution
‎07-10-2014 03:46 PM
Super User
Posts: 10,500

Re: Invalid numeric data error

When you use this syntax:

if rs9939609 = 44

SAS will attempt to convert the variable rs9939609 to numeric since you have asked it to be compared to a number, not a character.

The note is saying it can't conver 'TT' to a valid numeric.

The comparison should be

if rs9939609 = '44'

and similar so you compare character value to a character if you don't want the notes.

View solution in original post


All Replies
Super User
Super User
Posts: 7,401

Re: Invalid numeric data error

Hi,

The variable rs9939609 is a character variable holding data such as TT or AT, you are trying to compare that to a numeric 44 or 14, hence you get the notes.  This is my assumption from what you have provided.

Super User
Posts: 17,831

Re: Invalid numeric data error

Post the full code/log. You'll note that the error is for rs9939609 so there's something wrong with that variable. Most likely you forgot _new for one of the if then lines or the variable is originally a text variable and should be = '11' rather than =11.

You should also be using if/then/else rather than if/then.

Occasional Contributor
Posts: 8

Re: Invalid numeric data error

This is the full log:

8           proc FORMAT;

9         

9        !  VALUE ELIGFMT

10         1 = "Eligible"

11         2 = "Under age 17"

12         3 = "Ineligible" ;

NOTE: Format ELIGFMT has been output.

13       

13       !  VALUE MORTFMT

14         0 = "Assumed alive"

15         1 = "Assumed deceased"

16         . = "Ineligible or under age 17";

NOTE: Format MORTFMT has been output.

17         RUN ;

NOTE: PROCEDURE FORMAT used (Total process time):

      real time           0.05 seconds

      cpu time            0.00 seconds

     

18        

19         data nyu ;

20         set ahn_final834 ;

21        

22         if PEPMNK1R = 888 then PEPMNK1R=. ;

23         if PM10StEYM20MeanW ne . and PEPMNK1R ne .

24         then eligible = 1 ; else eligible = 0 ; * SUBSET ELIGIBLE ;

25        

26         if HSSEX=2 then HSSEX=0; * 0=F, 1=M ;

27       

28        

29         if TGP = 8888 or TGP>1450 then TGP=. ;

30         if TCP = 888 or TCP>600 then TCP=. ;                           * remove extreme values ;

31       

32         if BMPBMI = 8888 then BMPBMI=. ;

33         if 0<BMPBMI<18.5 then bmi=1 ;

34         if BMPBMI>=18.5 and BMPBMI<25 then bmi=4 ;

35         if BMPBMI>=25 and BMPBMI<30 then bmi=2 ;

36         if BMPBMI>=30 then bmi=3 ;

37         if BMPBMI=. or BMPBMI=0 then bmi=0 ;

38        

39         if HAR1=2 then smoke=3 ;

40         if HAR1=1 and HAR3=2 then smoke=2 ;

41         if HAR1=1 and HAR3=1 then smoke=1 ;

42         if HAR1=. or HAR1=8 or HAR3=8 then smoke=3 ;

43        

44        

45         if DMARACER=1 then race=2 ;

46         if DMARACER=2 then race=1 ;

47         if DMARACER in (3,8) then race=0 ;

48        

49       

50         pm_iqr = PM10StEYM20MeanW / 10.8486 ; * PM10 per IQR ;

51        

52         log_TG = log(TGP);

53        

54         if rs9939609 = 44 then rs9939609_new = "TT";

55         if rs9939609 = 14 then rs9939609_new = "AT";

56         if rs9939609 = 11 then rs9939609_new = "AA";

57        

58        

59         if rs515135 = "GG" then snp1 = "wt" ;

60         if rs515135 in ("AG", "AA")  then snp1 = "var" ;

61        

62         if rs3751812 = "GG" then snp2 = "wt" ;

63         if rs3751812 in ("GT", "TT")  then snp2 = "var" ;

64        

65         if rs1454626 = "AA" then snp3 = "wt" ;

66         if rs1454626 in ("AC", "CC")  then snp3 = "var" ;

67        

68         if rs6919346 = "GG" then snp4 = "wt" ;

69         if rs6919346 in ("AG", "AA")  then snp4 = "var" ;

70        

71         if rs7903146 = 22 then snp5 = "wt" ;

72         if rs7903146 in (24, 44)  then snp5 = "var" ;

73        

74         if rs9939609_new = "TT" then snp6 = "wt" ;

75         if rs9939609_new in ("AA", "AT") then snp6 = "var" ;

76        

77         if rs17366743 = "TT" then snp7 = "wt" ;

78         if rs17366743 in ("CT", "CC") then snp7 = "var" ;

79        

80         if rs17782313_A = "TT" then snp8 = "wt" ;

81         if rs17782313_A in ("CT", "CC") then snp8 = "var" ;

82         run;

NOTE: Character values have been converted to numeric values at the places given by: (Line)Smiley SadColumn).

      54:5   55:5   56:5  

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

_N_=10122

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='TT' , at line 56 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 54 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 55 column 5.

NOTE: Invalid numeric data, rs9939609='AT' , at line 56 column 5.

NOTE: Missing values were generated as a result of performing an operation on missing values.

      Each place is given by: (Number of times) at (Line)Smiley SadColumn).

      7151 at 50:28   2987 at 52:11  

NOTE: There were 20050 observations read from the data set WORK.AHN_FINAL834.

NOTE: The data set WORK.NYU has 20050 observations and 458 variables.

NOTE: At least one W.D format was too small for the number to be printed. The decimal may be shifted by the "BEST" format.

NOTE: DATA statement used (Total process time):

      real time           0.17 seconds

      cpu time            0.18 seconds

     

83          proc surveyreg data=nyu;

84         class HSSEX race bmi smoke DMPCREGN;

85         model log_TG = pm_iqr HSAGEIR HSSEX race bmi smoke DMPCREGN / CLPARM SOLUTION;

86         domain eligible*snp1;

87         run;

NOTE: In data set NYU, total 20050 observations read, 15118 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 1-5.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           1.03 seconds

      cpu time            1.03 seconds

     

88          proc surveyreg data=nyu;

89         class HSSEX race bmi smoke DMPCREGN;

90         model log_TG = pm_iqr HSAGEIR HSSEX race bmi smoke DMPCREGN / CLPARM SOLUTION;

91         domain eligible*snp2;

92         run;

NOTE: In data set NYU, total 20050 observations read, 15429 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 6-10.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.92 seconds

      cpu time            0.92 seconds

     

93          proc surveyreg data=nyu;

94         class HSSEX race bmi smoke DMPCREGN;

95         model log_TG =  pm_iqr HSAGEIR HSSEX race bmi smoke DMPCREGN / CLPARM SOLUTION;

96         domain eligible*snp3;

97         run;

NOTE: In data set NYU, total 20050 observations read, 15205 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 11-15.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.92 seconds

      cpu time            0.92 seconds

     

98          proc surveyreg data=nyu;

99         class HSSEX race bmi smoke DMPCREGN;

100         model log_TG = pm_iqr HSAGEIR HSSEX race bmi smoke DMPCREGN / CLPARM SOLUTION;

101         domain eligible*snp4;

102        run;

NOTE: In data set NYU, total 20050 observations read, 15204 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 16-20.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.92 seconds

      cpu time            0.92 seconds

     

103         proc surveyreg data=nyu;

104         class HSSEX race bmi smoke DMPCREGN;

105         model log_TG = pm_iqr HSAGEIR HSSEX race bmi smoke DMPCREGN / CLPARM SOLUTION;

106         domain eligible*snp5;

107        run;

NOTE: In data set NYU, total 20050 observations read, 15097 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 21-25.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.95 seconds

      cpu time            0.96 seconds

     

108         proc surveyreg data=nyu;

109         class HSSEX race bmi smoke DMPCREGN;

110         model log_TG = pm_iqr HSAGEIR HSSEX race bmi smoke DMPCREGN / CLPARM SOLUTION;

111         domain eligible*snp6;

112        run;

NOTE: In data set NYU, total 20050 observations read, 19973 observations with missing values are omitted.

NOTE: All observations were omitted due to missing values or non-positive weights in domain eligible=0 snp6=va.

NOTE: All observations were omitted due to missing values or non-positive weights in domain eligible=0 snp6=wt.

NOTE: The PROCEDURE SURVEYREG printed pages 26-28.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.69 seconds

      cpu time            0.70 seconds

     

113         proc surveyreg data=nyu;

114         class HSSEX race bmi smoke DMPCREGN;

115         model log_TG = pm_iqr HSAGEIR HSSEX race bmi smoke DMPCREGN / CLPARM SOLUTION;

116         domain eligible*snp7;

117        run;

NOTE: In data set NYU, total 20050 observations read, 15161 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 29-33.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.91 seconds

      cpu time            0.92 seconds

     

118         proc surveyreg data=nyu;

119         class HSSEX race bmi smoke DMPCREGN;

120         model log_TG = pm_iqr HSAGEIR HSSEX race bmi smoke DMPCREGN / CLPARM SOLUTION;

121         domain eligible*snp8;

122        run;

NOTE: In data set NYU, total 20050 observations read, 15118 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 34-38.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.91 seconds

      cpu time            0.92 seconds

     

123         proc surveyreg data=nyu;

124         class bmi HSSEX race smoke DMPCREGN snp1;

125         model log_TG = pm_iqr HSAGEIR HSSEX bmi race smoke DMPCREGN snp1 pm_iqr*snp1 / CLPARM SOLUTION;

126         domain eligible;

127        run;

NOTE: In data set NYU, total 20050 observations read, 15118 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 39-41.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.75 seconds

      cpu time            0.74 seconds

     

128         proc surveyreg data=nyu;

129         class  bmi HSSEX race smoke DMPCREGN snp2;

130         model log_TG = pm_iqr HSAGEIR HSSEX bmi race smoke DMPCREGN snp2 pm_iqr*snp2 / CLPARM SOLUTION;

131         domain eligible;

132        run;

NOTE: In data set NYU, total 20050 observations read, 15429 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 42-44.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.81 seconds

      cpu time            0.82 seconds

     

133         proc surveyreg data=nyu;

134         class bmi HSSEX race smoke DMPCREGN snp3 ;

135         model log_TG = pm_iqr HSAGEIR HSSEX bmi race smoke DMPCREGN snp3  pm_iqr*snp3 / CLPARM SOLUTION;

136         domain eligible;

137        run;

NOTE: In data set NYU, total 20050 observations read, 15205 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 45-47.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.74 seconds

      cpu time            0.73 seconds

     

138         proc surveyreg data=nyu;

139         class  bmi HSSEX race smoke DMPCREGN snp4;

140         model log_TG = pm_iqr HSAGEIR HSSEX bmi race smoke DMPCREGN snp4  pm_iqr*snp4 / CLPARM SOLUTION;

141         domain eligible;

142        run;

NOTE: In data set NYU, total 20050 observations read, 15204 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 48-50.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.80 seconds

      cpu time            0.79 seconds

     

143         proc surveyreg data=nyu;

144         class bmi HSSEX race smoke DMPCREGN snp5;

145         model log_TG = pm_iqr HSAGEIR HSSEX bmi race smoke DMPCREGN snp5  pm_iqr*snp5 / CLPARM SOLUTION;

146         domain eligible;

147        run;

NOTE: In data set NYU, total 20050 observations read, 15097 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 51-53.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.73 seconds

      cpu time            0.74 seconds

     

148         proc surveyreg data=nyu;

149         class bmi HSSEX race smoke DMPCREGN snp6;

150         model log_TG = pm_iqr HSAGEIR HSSEX bmi race smoke DMPCREGN snp6  pm_iqr*snp6 / CLPARM SOLUTION;

151         domain eligible;

152        run;

NOTE: In data set NYU, total 20050 observations read, 19973 observations with missing values are omitted.

NOTE: All observations were omitted due to missing values or non-positive weights in domain eligible=0.

NOTE: The PROCEDURE SURVEYREG printed pages 54-55.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.57 seconds

      cpu time            0.56 seconds

     

153         proc surveyreg data=nyu;

154         class bmi HSSEX race smoke DMPCREGN snp7;

155         model log_TG = pm_iqr HSAGEIR HSSEX bmi race smoke DMPCREGN snp7  pm_iqr*snp7 / CLPARM SOLUTION;

156         domain eligible;

157        run;

NOTE: In data set NYU, total 20050 observations read, 15161 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 56-58.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.73 seconds

      cpu time            0.73 seconds

     

158         proc surveyreg data=nyu;

159         class bmi HSSEX race smoke DMPCREGN snp8 ;

160         model log_TG = pm_iqr HSAGEIR HSSEX bmi race smoke DMPCREGN snp8  pm_iqr*snp8 / CLPARM SOLUTION;

161         domain eligible;

162        run;

NOTE: In data set NYU, total 20050 observations read, 15118 observations with missing values are omitted.

NOTE: The PROCEDURE SURVEYREG printed pages 59-61.

NOTE: PROCEDURE SURVEYREG used (Total process time):

      real time           0.74 seconds

      cpu time            0.74 seconds

     

163       

164       

165       

166       

NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414

NOTE: The SAS System used:

      real time           15.65 seconds

      cpu time            13.66 seconds

Super User
Super User
Posts: 7,401

Re: Invalid numeric data error

There is no mention in your log of what variable type rs9939609 is, I suspect it is character, hence you cannot do rs9939609=text without getting the notes.

Occasional Contributor
Posts: 8

Re: Invalid numeric data error

Sorry I'm a newbie to SAS.  Can you tell me what you are referring to when you say "notes"?

Super User
Posts: 10,500

Re: Invalid numeric data error

The item in the log starting with "NOTE:"

which are not errors but generally let you know you may be doing something a tad off from intended.

Occasional Contributor
Posts: 8

Re: Invalid numeric data error

Yes, it is a character.  I do not know why I get "Invalid numeric data" in the output.  That is the issue I am having, and I am not sure if it is affecting my results.

Solution
‎07-10-2014 03:46 PM
Super User
Posts: 10,500

Re: Invalid numeric data error

When you use this syntax:

if rs9939609 = 44

SAS will attempt to convert the variable rs9939609 to numeric since you have asked it to be compared to a number, not a character.

The note is saying it can't conver 'TT' to a valid numeric.

The comparison should be

if rs9939609 = '44'

and similar so you compare character value to a character if you don't want the notes.

SAS Employee
Posts: 15

Re: Invalid numeric data error

Hello Gita,

You can reproduce the error message if you attempt to assign a text value to a numeric variable:

data _null_;

  length

    rs9939609 8;

  rs9939609 = 'TT';

  if rs9939609 = 44 then rs9939609_new = 'TT';

run;

Is variable "rs9939609" in data set "ahn_final834" character or numeric?

Occasional Contributor
Posts: 8

Re: Invalid numeric data error

Thank you Jason.  I just converted the numeric variable (44) to a character variable ("44") as Ballardw pointed out and that took care of the "invalid numeric data."

Occasional Contributor
Posts: 8

Re: Invalid numeric data error

and "rs9939609" is a character variable.

SAS Employee
Posts: 15

Re: Invalid numeric data error

Okay.  Automatic numeric-character conversion is described here:

SAS Variables in Expressions :: SAS(R) 9.4 Language Reference: Concepts, Second Edition

☑ This topic is SOLVED.

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

Discussion stats
  • 12 replies
  • 7070 views
  • 0 likes
  • 5 in conversation