Page 1 of 1

wfopen data types specific to header name

Posted: Sun Dec 20, 2015 9:30 am
by CharlieEVIEWS
Dear All,

I have a problem I can't figure out a solution to - hopefully you can help!

I'm opening a large number of csv/xls/xlsx files in a loop as workfiles using the wfopen command. However, in some of the raw files, a variable exists, and in some, it does not. In my case, this variable is a registration identifier. One further problem is that this is in different columns in the raw files, although it always has the same name (regno). The problem is that EViews is automatically deciding that this variable is a number and importing it in as a series. However, in some of the workfiles, the underlying variables are alphanumeric (the identifiers contain letters as well as numbers - one example is IP29936R, and a numerical one is 1035401), but EViews is neglecting this and importing them as numerical series and throwing away the letters. Retaining the letters is critical for a future matching step.

My question therefore is: is there a way to open a named variable as a specific type? In my case, I always want to open this identifier, which is always called 'regno' as an alpha (character). For example, I have looked at something like:

Code: Select all

wfopen <{%CD}/filename.csv> ftype=ascii rectype=crlf skip=0 fieldtype=delimited delim=comma types=(,,A,) colhead=1 eoltype=pad badfield=NA @freq U 1 @smpl @all
but this is problematic because the position of the A in types=(,,A,) moves on every iteration. Ideally, I want something like:

Code: Select all

wfopen <{%CD}/filename.csv> ftype=ascii rectype=crlf skip=0 fieldtype=delimited delim=comma regno=(A) colhead=1 eoltype=pad badfield=NA @freq U 1 @smpl @all
but I cant quite figure out what to do.

As always, any suggestions would be greatly, hugely appreciated :-)

Best wishes as always - and Merry Christmas!

Charlie

Re: wfopen data types specific to header name

Posted: Sun Dec 20, 2015 4:04 pm
by EViews Gareth
Try adding a scan=all argument. That might help it auto-decide whether to make it alpha or series.