Create a comma separated string with quotes?

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

xprimexinverse
Posts: 39
Joined: Fri Sep 18, 2015 11:41 am
Location: Dublin, Ireland
Contact:

Create a comma separated string with quotes?

Postby xprimexinverse » Sun Aug 12, 2018 11:10 am

Hi everyone,

I would like to use the import command in an automated way and to do this I need to pass in the string values for the column head names as options.

For example, below I pass three strings into the colheadnames option of the import command.

Code: Select all

colheadnames=("Name","Unit_code","Unit_description")

However, the above example is hard coded and I don't want to do this. What I'd like to do is pass all of these individual strings in as a single string variable (or single argument).

For example, I'd like to be able to do this:

Code: Select all

%colheadnames = "Name","Unit_code","Unit_description"
colheadnames = (%colheadnames)


Any ideas?

Thanks,
Graeme
Last edited by xprimexinverse on Sun Aug 12, 2018 11:24 am, edited 1 time in total.

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

Re: Create a comma separated string with quotes?

Postby EViews Gareth » Sun Aug 12, 2018 11:12 am

Code: Select all

%colheadnames = """Name"",""Unit_code"",""Unit_description"""
Follow us on Twitter @IHSEViews

xprimexinverse
Posts: 39
Joined: Fri Sep 18, 2015 11:41 am
Location: Dublin, Ireland
Contact:

Re: Create a comma separated string with quotes?

Postby xprimexinverse » Sun Aug 12, 2018 1:14 pm

Thanks very much, Gareth! :D

Works a charm!


Return to “Programming”

Who is online

Users browsing this forum: Google [Bot] and 23 guests