for loop using strings and widcards

For questions regarding programming in the EViews programming language.

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

mark
Posts: 37
Joined: Thu Mar 12, 2009 3:27 pm

for loop using strings and widcards

Postby mark » Wed Oct 07, 2015 2:15 pm

Hi - Using eviews 9 enterprise
I have a dataset where the major identifier (variable) is a string called "projectnum" with a "-" stuck in the middle. Like this:
21838-0004
21838-0007
02101-0005
03901-0001 etc
I'm using a FOR loop AND a WILDCARD to pull each record associated with a specified projectnum - there are over 900 projects (I'm just showing the first string)
It crashes when I get to line 3 of the code listed below with the error message - illegal date 21838 in "SMPL 21838"
Suggestions? Thanks


smpl @all
for %1 ""21838*""
smpl @all if projectnum={%1}
totalbid.statby(nomean, sum, nostd, nocount) test2 worktype
smpl @all
next
stop

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

Re: for loop using strings and widcards

Postby EViews Gareth » Wed Oct 07, 2015 2:23 pm

You can't use a wildcard inside a smpl statement.

Use a string function such as @instr or @left.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests