run proc contents on all of your files, including the new categorical one. There is apparently a difference between one or more of them.
Hi,
Here are the attributes for the three datasets from the Proc Contents. Would you be able to tell me where the problem is????
This is like 'CATEGORIES dataset in your example....
*I got this by exporting one of the datasets which i am going to merge which has all combinations for my template into EXCEL, deleted the value column and imported back into SAS
Data Set Name WORK.TEMPLATE_FINAL Observations 55
Member Type DATA Variables 1
Engine V9 Indexes 0
Created Wed, Oct 24, 2012 08:36:24 AM Observation Length 25
Last Modified Wed, Oct 24, 2012 08:36:24 AM Deleted Observations 0
Protection Compressed NO
Data Set Type Sorted NO
Label
Data Representation WINDOWS_32
Encoding wlatin1 Western (Windows)
Alphabetic List of Variables and Attributes
# Variable Type Len Format Informat Label
1 categorical Char 25 $25. $25. categorical
*DATASET1;
Data Set Name WORK.STATC_OUT Observations 55
Member Type DATA Variables 2
Engine V9 Indexes 0
Created Wed, Oct 24, 2012 08:36:01 AM Observation Length 400
Last Modified Wed, Oct 24, 2012 08:36:02 AM Deleted Observations 0
Protection Compressed NO
Data Set Type Sorted NO
Label
Data Representation WINDOWS_32
Encoding wlatin1 Western (Windows)
Alphabetic List of Variables and Attributes
# Variable Type Len Format
1 categorical Char 200 $200.
2 value Char 200 $200.
*DATASET2;
Data Set Name WORK.STATQ_OUT Observations 49
Member Type DATA Variables 2
Engine V9 Indexes 0
Created Wed, Oct 24, 2012 08:36:06 AM Observation Length 400
Last Modified Wed, Oct 24, 2012 08:36:06 AM Deleted Observations 0
Protection Compressed NO
Data Set Type Sorted NO
Label
Data Representation WINDOWS_32
Encoding wlatin1 Western (Windows)
Alphabetic List of Variables and Attributes
# Variable Type Len Format
1 categorical Char 200 $200.
2 value Char 200 $200.
I would change the length of categorical in WORK.TEMPLATE_FINAL to $200 so that it matches your other files. That COULD be the mismatch, but I don't have any way of testing it this morning.
Just tested it and, definitely, the length difference would definitely cause the error you received.
Thats awesome. Finally. ...
Changed the length and format as well
I can only tell one thing ....the members are far far ahead of just answering a question... You are making us ask the right (Proper) Question tooo...and thinking what we are thinking being hundreds and thousands of miles apart!!!
One last question:
I thought Set statement will write one dataset below the other.....But whats happening when we write: How are we able to get the output as if we merged it????
data want;
set new1;
set new2;
run;
Could you also suggest me an article when I could get some good knowledge about classdata and idgroup usage in Proc summary??
The answer to your first question: it is called one-to-one matching. According to the documentation, at http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000173782.htm, it can be described as follows:
Use multiple SET statements to perform one-to-one reading (also called one-to-one matching) of the specified data sets. The new data set contains all the variables from all the input data sets. The number of observations in the new data set is the number of observations in the smallest original data set. If the data sets contain common variables, the values that are read in from the last data set replace the values that were read in from earlier ones. See Combining One Observation with Many, Performing a Table Lookup, and Performing a Table Lookup When the Master File Contains Duplicate Observations for examples of one-to-one reading of data sets.
As for your question about the use of classdata and idgroup in proc summary, I've leave that to data_null or someone else who can point you in the right direction. I, personally, learned about the method from data_null's examples. The only documentation I'm aware of, other than papers, pages and posts by data_null and Mike Zdeb is:
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/viewer.htm#a000146734.htm
Thanks a ton for the detailed information.
Regards
Create your format using leading zeros:
value $sort
'AGE'='01'
...
;
Hi ,
I can also do
invalue sort <<<<<<<<no dollar and invalue
'AGE'=01 >>>>>>>>no quotes for 01
Regards
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 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: