05-18-2016 11:01 AM - edited 05-18-2016 11:01 AM
When importing a .csv file to SAS VA I notice that some files are cutting the category vales short. For example, "Ireland" is showing up as "Irel", but in very few of the files it is showing up in full length. Any suggestions on how to make sure it loads with full length every time?
05-18-2016 11:12 AM
I suspect that this is related to how you are importing the data into SAS. If you are using Proc Import then the program guesses for each file what the characteristics should be. The program by default uses something like the first 20 rows to set the lengths of variables. If you are using proc import then as a minimum add the GUESSINGROWS option with a large value (it can be larger than the number of records in your data) something in the range of 20000 might work.
Better if you are reading multiple files with the same format is to create a Datastep program so you can have fixed characteristics for all of your variables. The good thing is that proc import generates a datastep and the log from your proc import step should have the base code. You can copy from the long and save as a program and just change the input file and output dataset. Set the length of you character variables (Informat will do) to the longest expected (I ususally add a few more characters to allow for "new" data values).