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

I have this question below. Should it be drop lev1 lev2? I'm not sure what else is wrong with this program. Any help is greatly appreciated!

 

1. What, if anything, is wrong with the following program? As usual, an ellipsis (. . .) represents portions of the program that have no bearing on the exercise.

 

     data one;

     infile . . . ;

     input id $ subgrp $ lev1 lev2;

     total = lev1 + lev2;

     drop lev1 lev2;

     run;

 

     proc freq data=one;

     tables total lev1 lev2;

     run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

You dropped lev1 and lev2 from data set one, therefore they do not exist in data set one. 

 

DROP removes variables from the data set. 

 

In the PROC FREQ you then try to use LEV1, LEV2 but they no longer exist.

 


@Amy0223 wrote:

I have this question below. Should it be drop lev1 lev2? I'm not sure what else is wrong with this program. Any help is greatly appreciated!

 

1. What, if anything, is wrong with the following program? As usual, an ellipsis (. . .) represents portions of the program that have no bearing on the exercise.

 

     data one;

     infile . . . ;

     input id $ subgrp $ lev1 lev2;

     total = lev1 + lev2;

     drop lev1 lev2;

     run;

 

     proc freq data=one;

     tables total lev1 lev2;

     run;

 


 

View solution in original post

2 REPLIES 2
Reeza
Super User

You dropped lev1 and lev2 from data set one, therefore they do not exist in data set one. 

 

DROP removes variables from the data set. 

 

In the PROC FREQ you then try to use LEV1, LEV2 but they no longer exist.

 


@Amy0223 wrote:

I have this question below. Should it be drop lev1 lev2? I'm not sure what else is wrong with this program. Any help is greatly appreciated!

 

1. What, if anything, is wrong with the following program? As usual, an ellipsis (. . .) represents portions of the program that have no bearing on the exercise.

 

     data one;

     infile . . . ;

     input id $ subgrp $ lev1 lev2;

     total = lev1 + lev2;

     drop lev1 lev2;

     run;

 

     proc freq data=one;

     tables total lev1 lev2;

     run;

 


 

Amy0223
Quartz | Level 8
Thank you very much! Your help is much appreciated 🙂

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 569 views
  • 0 likes
  • 2 in conversation