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

Q1; How to fix the following problem.

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):(Column).

     1 at 7:7     1 at 9:23   1 at 12:6   1 at 14:21   1 at 17:5   1 at 19:20   1 at 22:6   1 at 24:22   1 at 29:7

     1 at 31:23   1 at 38:6   1 at 42:21   1 at 47:6   1 at 51:24   1 at 56:10   1 at 67:30

NOTE: There were 1245 observations read from the data set XXX.KARIMI3.

NOTE: The data set XXX.KARIMI4 has 1245 observations and 97 variables.

NOTE: DATA statement used (Total process time):

     real time           0.09 seconds

     cpu time           0.06 seconds

 

 Q2. When I run proc fsedit it gives me only 891 observations

When I run proc freq it gives me 1244 observation? How to fix this?

 

WOULD LIKE also to get 1244 observations when I run fsedit. You have been very helpful in responding to my previous questions.

Please provide simple solutions, I am not competent in SAS

Wagdy

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

You will need to get help from someone who knows a little SAS, and can talk with you about  your data.  For example, consider this portion of your log:

 

7   Isr = sum (Q4a, Q47a, Q56a, Q65a);

8   Isr = 0;

9   IF Isr NE . THEN Isr= Sum (Q4a, Q47a, Q56a, Q65a);

 

Why use line 7, if you are planning on changing lsr to 0 on line 8?  Why bother with line 9, when lsr must be 0 because of line 8?

 

You need to be able to explain your intention and come up with some code that actually accomplishes what you are looking for.

View solution in original post

6 REPLIES 6
mkeintz
PROC Star

You have provided log notes identifying statement numbers where missing values were input to some mathematical operation, generating missing values as the result. 

 

But we can't help if you don't also show the log with those statement numbers and the associated statements.  Help us help you.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
wagdy
Obsidian | Level 7

LIBNAME XXX 'c:\users\wagdy';

NOTE: Libref XXX was successfully assigned as follows:

     Engine:       V9

     Physical Name: c:\users\wagdy

3   DATA XXX.KARIMI4;

4   set XXX.KARIMI3;

5

6     /* scale # 1: attitude towards Israel (4 items) */

7   Isr = sum (Q4a, Q47a, Q56a, Q65a);

8   Isr = 0;

9   IF Isr NE . THEN Isr= Sum (Q4a, Q47a, Q56a, Q65a);

10

11   /* scale # 2: PV middle-east religiously based political views (5 items)*/

12   PV = sum (Q2a, Q14a, Q22a,Q61a, Q76a);

13   PV = 0;

14   IF PV NE . THEN PV= sum (Q2a, Q14a, Q22a,Q61a, Q76a);

15

16   /* scale # 3:NEGATIVE attitude toward Women, (5 ITEMS)*/

17   W = SUM (Q30a,Q40a, Q46a, Q62a, Q70a);

18   W = 0;

19   IF W NE . THEN W = SUM (Q30a,Q40a, Q46a, Q62a, Q70a);

20

21   /* scale # 4:NEGATIVE ATTITUDES TOWARDS THE WESTERN CULTURE (5 ITMS)*/

22   WC = SUM (Q5a, Q10a,Q28a,Q38a,Q55a);

23   WC =0;

24   IF WC NE . THEN WC = SUM (Q5a,Q10a,Q28a,Q38a,Q55a);

25

26

27   /* scale # 5: superiority Sup (6 items) */

28

29   SUP = SUM (Q9a,Q17a,Q26a,Q27a,Q36a,Q79a);

30   SUP = 0;

31   IF SUP NE . THEN SUP= SUM (Q9a,Q17a,Q26a,Q27a,Q36a,Q79a);

32

33   /* scale # 6: JE (8 items) based attitude of Condoning fight,

34   believe in the use of force, ideology of Jihad, non-tolerance

35   for others, uncompromising thinking, and no peaceful solution

36   is possible)*/

37

38   JE = SUM (Q6a, Q19a, Q24a,Q29a,Q34a,Q39a, Q44a,

39           Q50a);

40

41   JE = 0;

42   IF JE NE . THEN JE= SUM (Q6a,Q19a, Q24a, Q29a,Q34a,Q39a, Q44a, Q50a);

43

44   /* religiously thinking person; religious is very important

45   to this person, STRONG RELIGIOUS BELIEFS/IDEOLOGIES (25 items) */

46   /* religious */

47   REL= sum

48   (Q13a,Q21a, Q33a,Q45a,Q54a,Q73a);

49

50   REL=0;

51   IF REL NE . THEN REL = sum

52   (Q13a,Q21a, Q33a,Q45a,Q54a,Q73a);

53

54

55   /* TOTALBDS TOTBDS(33)*/

56   TOTBDS = sum

57   (Q2a, Q4a, Q5a, Q6a,

58   Q10a,Q13a,Q14a, Q19a,

59   Q21a, Q22a,Q24a, Q28a,Q29a,

60   Q30a, Q33a,Q34a, Q38a,Q39a,

61   Q40a, Q44a,Q45a, Q46a,Q47a,

62   Q50a, Q54a,Q55a, Q56a,

63   Q61a, Q62a,Q65a,

64   Q70a, Q73a,Q76a);

65   TOTBDS=0;

66

67   IF TOTBDS NE . THEN TOTBDS = sum

68   (Q2a, Q4a, Q5a, Q6a,

69   Q10a,Q13a,Q14a, Q19a,

70   Q21a, Q22a,Q24a, Q28a,Q29a,

71   Q30a, Q33a,Q34a, Q38a,Q39a,

72   Q40a, Q44a,Q45a, Q46a,Q47a,

73   Q50a, Q54a,Q55a, Q56a,

74   Q61a, Q62a,Q65a, Q70a, Q73a,Q76a); run;

 

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):(Column).

     1 at 7:7     1 at 9:23   1 at 12:6   1 at 14:21   1 at 17:5   1 at 19:20   1 at 22:6   1 at 24:22   1 at 29:7

     1 at 31:23   1 at 38:6   1 at 42:21   1 at 47:6   1 at 51:24   1 at 56:10   1 at 67:30

NOTE: There were 1245 observations read from the data set XXX.KARIMI3.

NOTE: The data set XXX.KARIMI4 has 1245 observations and 97 variables.

NOTE: DATA statement used (Total process time):

     real time           0.09 seconds

     cpu time           0.06 seconds

 

 

75

76   proc fsedit; run;

 

Q1. When I proc fsedit it gives me only 891 observations

When I run proc freq it gives me 1244 observation? How to fix this?

wagdy
Obsidian | Level 7

      Karimi2 FILE

                  Orignal4 file was created using exactly same program.

LIBNAME XXX 'c:\users\wagdy';

Data XXX.karimi2;        

set XXX.karimi1;        

      if Q1=1 or Q1=2 then q1=0;

      if Q1=3 or Q1=4 then q1=1;

      if Q2=1 or Q2=2 then q2=0;

      if Q2=3 or Q2=4 then q2=1;

      if Q3=1 or Q3=2 then q3=0;

      if Q3=3 or Q3=4 then q3=1;

      Continue to  

      if Q80=1 or Q80=2 then q8=0;

      if Q80=3 or Q80=4 then q8=1;

 

Isr = sum (Q4, Q47, Q56, Q65);

Isr = 0;

IF Isr NE . THEN Isr= Sum (Q4, Q47, Q56, Q65);

 

PV = sum (Q2, Q14, Q22,Q61, Q76);

PV = 0;

IF PV NE . THEN PV= sum (Q2, Q14, Q22,Q61, Q76);

 

W = SUM (Q30,Q40, Q46, Q62, Q70);

W = 0;

IF W NE . THEN W = SUM (Q30,Q40, Q46, Q62, Q70);

 

WC = SUM (Q5, Q10,Q28,Q38,Q55);

WC =0;

IF WC NE . THEN WC = SUM (Q5,Q10,Q28,Q38,Q55);

 

SUP = SUM (Q9,Q17,Q26,Q27,Q36,Q79);

SUP = 0;

IF SUP NE . THEN SUP= SUM (Q9,Q17,Q26,Q27,Q36,Q79);

 

 

JE = SUM (Q6, Q19, Q24,Q29,Q34,Q39, Q44,Q50);

JE = 0;

IF JE NE . THEN JE= SUM (Q6,Q19, Q24, Q29,Q34,Q39, Q44,Q50);                  

 

REL= sum (Q13,Q21, Q33,Q45,Q54,Q73);

REL=0;

IF REL NE . THEN REL = sum

(Q13,Q21, Q33,Q45,Q54,Q73);

 

TOTBDS = sum

(Q2, Q4, Q5, Q6,

Q10,Q13,Q14, Q19,

Q21, Q22,Q24, Q28,Q29,

Q30, Q33,Q34, Q38,Q39,

Q40, Q44,Q45, Q46,Q47,

Q50, Q54,Q55, Q56,

Q61, Q62,Q65,

Q70, Q73,Q76);

TOTBSD=0;

 

IF TOTBDS NE . THEN TOTBDS = sum

(Q2, Q4, Q5, Q6,

Q10,Q13,Q14, Q19,

Q21, Q22,Q24, Q28,Q29,

Q30, Q33,Q34, Q38,Q39,

Q40, Q44,Q45, Q46,Q47,

Q50, Q54,Q55, Q56,

Q61, Q62,Q65,

Q70, Q73,Q76); run;

mkeintz
PROC Star

While your log reports 16 instances of generating missing values, it's actually 8 problems.   That's because you have 8 sets of three statements with the following structure:

 

    X=sum(a,b,c);
    X=0;
    if X^=, then X=sum(a,b,c);

 

You would get exactly the same resulting data set if you dropped the 2nd and 3rd statements from each set of 3 statements like the above.  After all, no matter what the result of the 1st statement, you assign a value of zero to the result variable in the 2nd statement.  And that in turn means the if test in the third statement is always true, so the same sum operation is repeated.  Therefore every record that generates a "missing" log note (and only such records) in the first statement will also generate a "missing" log note for the third statement.

 

So get rid of the 2nd and 3rd statements.

 

That leaves 8 messages effectively reporting that all the variables being summed (arguments of the SUM operation) in a single statement are missing, so the result is also missing.  While each of the 8 conditions might occur in 8 unique records, I suspect that all of them happen in a single record, which likely has all its incoming variables missing.  Probably because of some spurious generation of a missing record in a prior step.   So you have to determine whether that is acceptable, and if not, identify the offending record.

 

This is also why your proc freq has 1,244 obs instead of 1,245, although you haven't reported which variable(s)  is/are being tabulated.

 

 

 

 

 

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
Astounding
PROC Star

You will need to get help from someone who knows a little SAS, and can talk with you about  your data.  For example, consider this portion of your log:

 

7   Isr = sum (Q4a, Q47a, Q56a, Q65a);

8   Isr = 0;

9   IF Isr NE . THEN Isr= Sum (Q4a, Q47a, Q56a, Q65a);

 

Why use line 7, if you are planning on changing lsr to 0 on line 8?  Why bother with line 9, when lsr must be 0 because of line 8?

 

You need to be able to explain your intention and come up with some code that actually accomplishes what you are looking for.

VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

It is not just lines 7-8-9 it is the whole program,  You need someone with logic ability to do this simple steps. 

We do not sum then set the sum to 0 then re-sum the same variables.  That just doesn't make since. 12-13-14 and 17-18-19 and so on in the log.

 

The cost of hiring someone with logic ability should not be that hard nor costly. 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 2533 views
  • 0 likes
  • 4 in conversation