BookmarkSubscribeRSS Feed
deleted_user
Not applicable
data period2A;
infile 'c:\Cwa\period2_sales_data_A.dat';
Input TransactionID $1-8
DateofSale $9-18
LaptopModel $19-24
UnitsSold 25-27
Warranty 28;
proc print data=period2A;
run;

data period2B;
infile 'c:\Cwa\period2_sales_data_B.dat';
Input TransactionID $1-8
TimeofSale $9-16;
proc print data=period2B;
run;

proc append base = period2A data= period2B ;
run;

The LOG wiindow after running the append command says :


301 proc append base = period2A data= period2B ;
302 run;

NOTE: Appending WORK.PERIOD2B to WORK.PERIOD2A.
WARNING: Variable TimeofSale was not found on BASE file. The variable will not be added to the BASE
file.
WARNING: Variable DateofSale was not found on DATA file.
WARNING: Variable LaptopModel was not found on DATA file.
WARNING: Variable UnitsSold was not found on DATA file.
WARNING: Variable Warranty was not found on DATA file.
ERROR: No appending done because of anomalies listed above. Use FORCE option to append these files.
NOTE: 0 observations added.
NOTE: The data set WORK.PERIOD2A has 245 observations and 5 variables.
NOTE: Statements not processed because of errors noted above.
NOTE: PROCEDURE APPEND used (Total process time):
real time 0.07 seconds
cpu time 0.01 seconds

NOTE: The SAS System stopped processing this step because of errors.

what am i mistaken in ?

kindly guide.

mark
3 REPLIES 3
Flip
Fluorite | Level 6
Proc append simply does what it says, adds one dataset to the end of the other. The FORCE option will make it append with differing variables, but your data has none in common.

My guess is that you want to merge the datasets not append.

so sort both then do.

data new;
merge period2A period 2B;
by TransactionID;
RUN;
deleted_user
Not applicable
I used the follwing code :

libname sc 'c:\Cwa';
data sc.period2A;
infile 'c:\Cwa\period2_sales_data_A.dat';
Input TransactionID $1-8
DateofSale $9-18
LaptopModel $19-24
UnitsSold 25-27
Warranty 28;
proc sort data=period 2A;
By TransactionID;
Run;
proc print data=period2A;
run;


data sc.period2B;
infile 'c:\Cwa\period2_sales_data_B.dat';
Input TransactionID $1-8
TimeofSale $9-16;
proc sort data=period 2B;
By TransactionID;
Run;
proc print data=period2B;
run;


data sc.new;
merge period2A period 2B;
by TransactionID;
RUN;
proc print data = new;
Run;


A Sample of the Log window showing errors is :

18 proc sort data=period 2B;
-
22
200
ERROR: File WORK.PERIOD.DATA does not exist.
ERROR 22-322: Syntax error, expecting one of the following: ;, (, ASCII, BUFFNO, DANISH, DATA,.... )

ERROR 200-322: The symbol is not recognized and will be ignored.
19 By TransactionID;
20 Run;

51 data sc.new;
52 merge period2A period 2B;
-
22
200
ERROR: File WORK.PERIOD.DATA does not exist.
ERROR: File WORK.B.DATA does not exist.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, -, :, ;, END,
_DATA_, _LAST_, _NULL_.

ERROR 200-322: The symbol is not recognized and will be ignored.

53 by TransactionID;
54 RUN;

what mistake have i made ?

kindly guide .

mark

NOTE: The SAS System stopped processing this step because of errors.
Flip
Fluorite | Level 6
Read your log. You can't have a space in the middle of a dataset name.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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