BookmarkSubscribeRSS Feed
francisca
Calcite | Level 5

This is my code:

 

data weight_club;
input IdNumber 1-6 Name $ 7-24 Team $ Job_title $ Salary StartWeight EndWeight Hire_date;
/*Loss=StartWeight-EndWeight;*/
datalines;
1023 David Shaw red Trainee 10000 189 165 122015
1049 Amelia Serrano yellow Trainee 20000 145 124 122015
1219 Alan Nance red Trainee 30000 210 192 122015
1246 Ravi Sinha yellow Trainee 10000 194 177 122015
1078 Ashley McKnight red Engineer 40000 127 118 122015
;
/*label Job_title='Sales Title'
Hire_date='Date Hired';
format Salary dollar8.;
format Hire_date ddmmyy10.;
var Name Job_title Salary Hire_date;*/
format Hire_date mmddyy10.

run;
proc print data = weight_club;
title " Fitness Center Weigh Club";
run;

 

 

I get this error:

 

66 /*label Job_title='Sales Title'
67 Hire_date='Date Hired';
68 format Salary dollar8.;
69 format Hire_date ddmmyy10.;
70 var Name Job_title Salary Hire_date;*/
71 format Hire_date mmddyy10.
______
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
 
3 REPLIES 3
LinusH
Tourmaline | Level 20
You cannot have statements after datalines.
Data never sleeps
francisca
Calcite | Level 5
Thank you very much

##- Please type your reply above this line. Simple formatting, no
attachments. -##
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Move the format statement up, also your code gives other problems when reading the data from datalines - idnumber is not 6 characters long.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 3 replies
  • 1179 views
  • 0 likes
  • 3 in conversation