Hi,
I am not able to understand that why I am getting below error whereas my formats are fine from source ,
ERROR: Character expression requires a character format. Can anybody please suggest.
contents of interim.member_CRS2:
Alphabetic List of Variables and Attributes | ||||||
# | Variable | Type | Len | Format | Informat | Label |
4 | CARRIER_NAME | Char | 50 | $50.00 | $50.00 | CARRIER_NAME |
3 | CO_CD | Char | 3 | $3.00 | $3.00 | CO_CD |
14 | DEPN_NBR | Char | 3 | $3.00 | $3.00 | DEPN_NBR |
1 | EMP_STATUS | Char | 5 | $5.00 | $5.00 | EMP_STATUS |
17 | FIRST_NAME | Char | 50 | $50.00 | $50.00 | FIRST_NAME |
12 | INDV_ID | Num | 8 | 11 | 11 | INDV_ID |
18 | LAST_NAME | Char | 100 | $100.00 | $100.00 | LAST_NAME |
30 | PERSON_ID | Num | 8 | PERSON_ID | ||
7 | PRDCT_CD | Char | 30 | $30.00 | $30.00 | PRDCT_CD |
8 | SBSCR_ID | Char | 11 | $11.00 | $11.00 | SBSCR_ID |
11 | clmnt_id | Char | 20 | $20.00 | $20.00 | clmnt_id |
29 | cov_end_mth | Num | 4 | |||
28 | cov_start_mth | Num | 4 | |||
27 | cust_defined_key | Num | 8 | |||
20 | cust_detail_ky_char | Char | 20 | |||
9 | cust_seg_nbr | Char | 20 | $20.00 | $20.00 | cust_seg_nbr |
5 | fund_arng_cd | Char | 1 | $1.00 | $1.00 | fund_arng_cd |
16 | gender | Char | 1 | $1.00 | $1.00 | gender |
6 | hmo_acct_div_nbr | Num | 8 | 6 | 6 | hmo_acct_div_nbr |
26 | indus_prdct_cd | Num | 8 | |||
25 | key2 | Char | 90 | |||
15 | mbr_zip_cd | Char | 15 | $15.00 | $15.00 | mbr_zip_cd |
21 | med_cov_ind | Char | 1 | |||
2 | medicare_ind | Char | 1 | $1.00 | $1.00 | medicare_ind |
10 | optum_seg_id | Char | 8 | $8.00 | $8.00 | optum_seg_id |
13 | pat_dob | Num | 8 | DATE9. | DATE9. | pat_dob |
24 | rel_cd | Num | 8 | |||
22 | rx_cov_ind | Char | 1 | |||
23 | sbscr_ssn | Char | 9 | |||
19 | source | Char | 1 |
contents of from the source table :
Alphabetic List of Variables and Attributes | ||||||
# | Variable | Type | Len | Format | Informat | Label |
5 | CARRIER_NAME | Char | 50 | $50.00 | $50.00 | CARRIER_NAME |
4 | CO_CD | Char | 3 | $3.00 | $3.00 | CO_CD |
15 | DEPN_NBR | Char | 3 | $3.00 | $3.00 | DEPN_NBR |
2 | EMP_STATUS | Char | 5 | $5.00 | $5.00 | EMP_STATUS |
18 | FIRST_NAME | Char | 50 | $50.00 | $50.00 | FIRST_NAME |
13 | INDV_ID | Num | 8 | 11 | 11 | INDV_ID |
19 | LAST_NAME | Char | 100 | $100.00 | $100.00 | LAST_NAME |
1 | MBR_MO | Num | 8 | 11 | 11 | MBR_MO |
8 | PRDCT_CD | Char | 30 | $30.00 | $30.00 | PRDCT_CD |
9 | SBSCR_ID | Char | 11 | $11.00 | $11.00 | SBSCR_ID |
12 | clmnt_id | Char | 20 | $20.00 | $20.00 | clmnt_id |
21 | cust_detail_ky_char | Char | 20 | |||
10 | cust_seg_nbr | Char | 20 | $20.00 | $20.00 | cust_seg_nbr |
6 | fund_arng_cd | Char | 1 | $1.00 | $1.00 | fund_arng_cd |
17 | gender | Char | 1 | $1.00 | $1.00 | gender |
7 | hmo_acct_div_nbr | Num | 8 | 6 | 6 | hmo_acct_div_nbr |
16 | mbr_zip_cd | Char | 15 | $15.00 | $15.00 | mbr_zip_cd |
22 | med_cov_ind | Char | 1 | |||
3 | medicare_ind | Char | 1 | $1.00 | $1.00 | medicare_ind |
11 | optum_seg_id | Char | 8 | $8.00 | $8.00 | optum_seg_id |
14 | pat_dob | Num | 8 | DATE9. | DATE9. | pat_dob |
25 | rel_cd | Num | 8 | |||
23 | rx_cov_ind | Char | 1 | |||
24 | sbscr_ssn | Char | 9 | |||
20 | source | Char | 1 |
I think it's because fund_arng_cd is a character variable, but the format is "3.".
Try modifying it to "$3.".
I think it's because fund_arng_cd is a character variable, but the format is "3.".
Try modifying it to "$3.".
Aside from fund_arng_cd being character, it also makes no sense defining it with a length of 3, as it is defined in the source with $1 and can never have more than one character.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.