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 🙂

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 951 views
  • 0 likes
  • 2 in conversation