wfopen data types specific to header name

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

CharlieEVIEWS
Posts: 202
Joined: Tue Jul 17, 2012 9:47 am

wfopen data types specific to header name

Postby CharlieEVIEWS » Sun Dec 20, 2015 9:30 am

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

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13603
Joined: Tue Sep 16, 2008 5:38 pm

Re: wfopen data types specific to header name

Postby EViews Gareth » Sun Dec 20, 2015 4:04 pm

Try adding a scan=all argument. That might help it auto-decide whether to make it alpha or series.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests